The Moon spins on its axis in a way that always lets it present the same side towards the Earth as it orbits the Earth once each lunar month. There are many other examples of planetary moons that are locked in synchrony in this way, including the inner moons of Jupiter and Saturn I believe. The best idea that we have is that it has to do with the fact that moons that are too close to their planet are inherently NOT spherical and homogeneous. The tidal gravitational force of the planet they orbit, deforms these inner satellites into slightly foot-ball or egg-shaped objects. Their internal structure may also be inhomogeneous with slightly more denser material in one hemisphere than another. When the gravitational forces act upon such asymmetrical shapes over time, the satellites receive periodic torques because their shapes and interior mass distributions feel the gravitational forces slightly stronger during one part of their 'day' than another part of their 'day' as they orbit the planet once each 'year'. This causes a resonant forcing situation to arise that repeats itself regularly. As an example, when you push a child on a swing, you apply a rather weak but persistent and periodic 'push' at one part of the swing cycle, and this can cause the swing over time to either reduce its amplitude or increase it.
Eventually, over millions of years, the Moon settles down to a spin-orbit period that is some very simple harmonic such as 1:1 for synchrony, or 2:3 as for Mercury's resonance pattern with the sun. Other ratios are also possible, and are found in the ring system of Saturn. The gaps in Saturn's rings are caused by periodic pushes by the satellites of Saturn upon material that should have been in those 'gaps' but which was eventually ejected by this periodic forcing.