This is happening due to refraction, which is when light changes direction due to a change in medium.

7