Change of Speed Results in Change in Direction
A light ray refracts whenever it travels at an angle into a medium of different refractive index. This change in speed results in a change in direction. As an example, consider air travelling into water. The speed of light decreases as it continues to travel at a different angle.

Refraction of light in glass is shown in the figure above. When light travels from air into glass, the light slows down and changes direction slightly. When light travels from a less dense substance to a denser substance, the refracted light bends more towards the normal line. If the light wave approaches the boundary in a direction that is perpendicular to it, the light ray doesn’t refract in spite of the change in speed.