Most of the waves in the ocean are actually caused by wind! When wind blows and pushes across the surface of the water, it causes the water to move around... and this creates waves!
Once the wind has made one part of the water move into a wave, that part of the water passes this energy on to its neighbor, who uses this energy to move and wave also. This happens all the way along to the shore, which is why you often see bigger waves turning into smaller and smaller waves all the way in! The wave finally "ends" when it reaches the shallow shore of the beach, where it basically falls on top of itself because there is no more water left, and it cannot "pass" the wave any further!