the water's motion comes mostly from the gravity of the moon and the sun (mainly the moon), which exert non-negligible forces on the oceans. As the Earth rotates and the moon orbits, the gravity is exerted on different parts of the Earth, causing the tides.