This phenomenon is an example of refraction, which is a property of waves. Refraction occurs when waves change their direction and speed as they pass through a medium with a different refractive index. In the case of light waves passing from glass to air, the speed of light is different in the two mediums, and this causes the light waves to bend as they exit the glass and enter the air. This bending of light is why objects can appear distorted when viewed through a transparent material like glass or water.