Stars don't twinkle in real but they emit a constant source of light and as they are far away they appear to be a tiny dot of the source of light.
The light from stars passes through the different refractive indexes present in the earth's environment and this causes the appearance of twinkling.