This is because the Moon takes about 29.5 Earth days to complete one orbit around the Earth. During this time, the Moon also rotates once on its axis, resulting in the same side of the Moon always facing Earth.
It's important to note that this is different from a sidereal day on the Moon, which is 27.3 Earth days long. This is the time it takes the Moon to rotate once on its axis relative to the stars.