The twinkling of stars is due to the atmospheric refraction of star's light. When the light from a star enters the earth's atmosphere, it undergoes refraction due to the varying optical densities of  air at various altitudes. The continuously changing atmosphere refracts the light from the stars by different amounts from one moment to next. When the atmosphere refracts more light towards us, the star appears to be bright and when it refracts less star-light, then the star appears to be dim. In this way, the star light reaching our eyes increases and decreases continuously due to atmospheric refraction and the star appears to twinkle.
Stellar scintillation is the scientific name of twinkling of stars.As the light of stars travel through many layers of earth's atmosphere that's why stars appear as tiny dots from earth. The light of the star refracted many times and in random direction. This results in the star winking it looks as if stars moves a bit and our eyes interpret this action as twinkling of the stars