Something that happens occasionally doesn't happen all the time, just every once in a while. You play poker occasionally just to remind yourself that you always lose.
The adverb occasionally is good for things that happen every now and then. You get tired of the cold occasionally, but the snow is lovely. Occasionally, you think of your long lost love, but never write. The idea comes to you occasionally that you should move somewhere with more people and warmer weather. I worry about you occasionally.