Our atmosphere is a turbulent place. The waves of air moving about bend and bounce the light rays around a little bit, just like you'd see if you shine a flashlight under a glass of water and then look down the glass while swirling it a bit. Your eye picks up the slight adjustments in the star's light as a twinkle. Stars near the horizon twinkle more than those overhead because the light passes through more of the atmosphere near the horizon. Out in space, stars don't twinkle at all.
Why don't planets twinkle? They are closer to Earth, so they appear a little larger in the sky, to the point where you don't notice the slight adjustments in their light beam.
For More Information: