Why do waves crash at the beach?

Waves pile up and topple when shallow water slows the bottom of the wave first.