Refraction air to water or glass
When light travels from air to water the light slows down and changes direction. The light turns towards the normal line.
At a microscopic level think of the ray of light as having some width. Think of it as a tractor moving from a fast road onto a slow muddy, grassy field.
The first wheel hits the muddy grass, struggling for grip, and slows down. The other side is still travelling well on the road. This makes the tractor slow down and change direction.
(This is the same for light waves or water waves)
Light rays travel at 300,000km/s through the air but as they hit the surface of water they slow down to 226,000km/s. Light entering water slows down to about two thirds of its speed in air.
The same effect occurs from air to glass.
When light enters a more dense substance (a higher refractive index) it bends towards the normal line.