Refraction happens when a wave crosses a boundary between two materials and its speed changes. The frequency of the wave is set by the source and stays the same. Because v = f × λ, if the speed changes while the frequency stays the same, the wavelength must change too. A wave that slows down has a shorter wavelength. A wave that speeds up has a longer wavelength.
If the wave hits the boundary at an angle, its direction changes as well. Imagine a straight wavefront reaching the boundary. One end of the wavefront arrives first. If the new material is slower, that end slows down first while the other end is still travelling faster, so the wavefront turns. The wave bends towards the normal. If the new material is faster, the wave bends away from the normal.
If the wave hits the boundary along the normal (at 90° to the boundary), all of the wavefront changes speed at the same moment. The wave does not change direction, but its speed and wavelength still change.
Examples: light slows down when it passes from air into glass, so it bends towards the normal. Water waves travel more slowly in shallow water than in deep water, so they bend towards the normal when they move from deep into shallow water.