The Moon has a much weaker magnetic field than the Earth, but much stronger than can easily accounted for, and not arranged in a bipolar bar-magnet style like that of the Earth, but made up of a patchwork of magnetic fields, with different orientations on different parts of the surface. This patchwork is seem on Earth too, where it is useful for dating and placing rocks. When liquid magma cools to form rocks, magnetic particles aligned with the Earth's magnetic field are trapped in their position at the time of freezing. Since both the Earth's continents and its magnetic fields drift over time, these preserved magnetic fields can be used by geologists like pieces in a jigsaw when reconstructing the history of rocks.
The patchwork magnetism of the Moon is harder to explain. It has been theorized that this represents frozen magnetic fields from a time when a young moon had an active magnetic dynamo similar to that of the Earth, but there is no other evidence to support the idea that the Moon ever had such a dynamo, and good reason to believe the Moon has never had a process analogous to continental drift, so this explanation is far from satisfying.
In a paper published in the journal Science on 9 March 2012, Mark Wieczorek of the Institut de Physique du Globe de Paris at Université Paris Diderot, Benjamin Weiss of the Department of Earth, Atmospheric, and Planetary Sciences at the Massachusetts Institute of Technology and Sarah Stewart of the Department of Earth and Planetary Sciences at Harvard University propose a new theory to explain the anomalous magnetic field of the Moon.
Image of the magnetic field of the lunar southern hemisphere, from Wieczorek et al. (2012).
Wieczoreck et al. noted that the Moon's magnetic field was strongest around the South Pole-Aitken basin on the far side of the Moon, the Moon's largest crater and with an estimated age of 3.9-4 billion years, probably one of the oldest. They then theorized that this could have been the result of an impact between the Moon and a large iron meteorite (not improbable), which exploded on impact, scattering magnetic material in random alignments over the surface of the Moon.
They then attempted to build a computer model of such an impact, and the effect it might have on the Moon's magnetic field, and found this scenario was remarkably easy to produce. They therefore suggest this is the best explanation for the Moon's current magnetic field, and that similar impacts may have helped to shape the magnetic fields of other bodies in the Solar System.