When waves meet shallow water they slow down.
When one side of a wave slows down, the wave bends towards that side. It is a process called refraction.
Think of driving a fast car on a road. At the edge of the road there is soft wet sand. If one side of the car came off the road and the two wheels on that side sank into the sand, that side of the car would slow down and the whole car would suddenly turn towards the slowing sand.
Waves turn towards the slower side and the shallow side is always slower.
This is why waves always bend towards the shore.
It is also why waves appear attracted to us when we view them from land.
You might also enjoy:
The Difference Between Waves and Swell
How to Read Water – The Book