Many babies start doing a head shaking thing as part of learning to get control of their body. They may be imitating you, or may have discovered they get lots of response from you when they try this trick.
However it may also indicate an ear infection, if you think your baby has had a cold, is running a fever, is less active then usual or may have an infection it is worth checking out. Babies will sometimes shake their head when the inner ear is blocked, and they are trying to get more comfortable.
Some babies also shake their head when they get tired. I remember one little baby that would shake her head until she fell asleep!
So in general, it is probably just an interesting stage, but worth checking for any infection.