The answer is "tidal friction."
Back in the day (as they say), the moon spun with respect to the Earth, so people (if there had been people around) could see all sides of the moon, if they looked long enough.
But the Moon is not totally solid. It is a mass of dust, sand and rocks that can change shape, just like a pile of dust, sand and rocks can change shape on the Earth.
The Earth's gravitational pull on the Moon actually makes the Moon bulge towards the Earth very slightly. The bulge is called a "tidal bulge." The overall effect is to make the Moon a kind of oval, with the long axis pointing towards the Earth.
But the Moon rotated with respect to the Earth (you have to say "with respect to the Earth, because the Moon is, even now, rotating with respect to the Sun; rotation, like all motion, is relative), so as a new part of the Moon's surface rotated around to face the Earth, it would bulge, then settle back down as it rotated away from the Earth, kind of like a "wave" in a sports stadium.
The overall effect was to knead the Moon like it was a ball of play-doh, raising its internal temperature slightly.
But there is a lot of friction when rocks and dust rub against each other, so that would tend to slow down the rotation.
Further, the bulge actually lagged a little bit. The materials making up the Moon don't respond instantly to gravity. So the bulge actually wasn't quite in line with the Earth, but was kind of running to catch up with it. The Earth pulled on that bulge more than on the non-bulging parts, so that further slowed down the Moon's rotation. This mechanism was significant only early in the Moon's history, since the effect becomes smaller as the Moon's rotation slows.
So over millennia, the Moon's rotation slowed down and stopped. The bulge stopped moving around the Moon's surface and settled in one spot, incidentally locking that spot in line with the Earth.