Why do the star twinkle?
The star appears as they are twinkling because of physical phenomena known as atmospheric refraction. Refraction is bending of a light ray when it passes from one medium to another medium. The process of the light ray deviates from its own way when it travels from one medium to another medium is known as refraction. To understand this you would have to go through your experience, have you seen the things across a fire? You would have observed the things appears to the eye flickering from their places it’s reseasoning is that when light ray falls on the things across the fire, the reflected rays pass from cooler air(one medium) to hotter air(another medium) in turn of this light ray deviates from its own path and then reaches to our eyes, due to the change in temperature of the air around the fire caused by the flame of fire changes the density of air, that causes positions of the image of the things changes continuously and the things appear to flicker or twinkle from their places.
The twinkling of the star is almost the same phenomenon as described earlier due to the atmospheric refraction. The stars are too far away from the earth, they look like small light points. The light from them has to pass a very long path. As we know the space between stars and the earth is vacuum, the light travels on the straightway until it reaches to the atmosphere of the earth, as soon as the light ray enters into the atmosphere of the earth, it starts to refract, and then as a result of continuing refraction of the light through the different layers of the atmosphere reaches to our eyes (the continue refraction of light ray occurs because of varying density of light).
We see the virtual image of the star. The temperature of these atmospheric layers varies causing variation in density resulting in the change in the path of refracted ray incidents on our eyes thus giving way changing of virtual positions of the star that is why stars appear as they are twinkling.
Why do planets not twinkle?
Planets are much closer because they are part of our solar system. Even they don’t have their own light they appear brighter than the stars because they are much nearer. The star looks like pinpoints and the light ray from there has a longer path so their rays are highly refracted as compared to the incoming rays from the planets, the planets look like a disc so the light rays from them fall to our eyes as a bunch of rays , this bunch of rays doesn’t refract that much as the ray of the star so their image appears to our eyes stable therefore the planets don’t twinkle.
You can see the video to clear your concept