Refraction happens when a wave does what

2 answers

changes direction due to a change in speed.

-got answer from wikipedia
That is according to the wave theory. The question is why....

Refraction happens when a wave enters a new medium with a different wave density.