The water bulges follow the Moon as it moves around the Earth. When the Moon is directly overhead, the water bulges are highest and we have a high tide. When the Moon is on the other side of the Earth, the water bulges are lowest and we have a low tide.
The Sun also exerts a gravitational force on the Earth, but its effect on the tides is smaller than that of the Moon. This is because the Sun is so much farther away from the Earth than the Moon.
The combined effect of the Moon's and Sun's gravitational forces on the Earth's oceans produce a complex pattern of tides that vary in height and timing from place to place.