For a while, scientists believed that water inside the Moon largely came from comets. However, they might have to rethink that belief. Researchers looking at Apollo mission lunar samples now suspect that most of the Moon's water came from asteroids smacking into the celestial body between 4.3 billion and 4.5 billion years ago, when it (and the Earth) was covered in a magma ocean. The key was to look at hydrogen isotopes. While comet water tends to be rich in deuterium, less than 20 percent of the Moon's water shows signs of it -- the isotope ratios were generally closer to that of the Earth, pointing to an asteroid origin.
There's even a possibility that as much as a quarter of the Moon's water came from the widely theorized Theia impact with the Earth around 4.5 billion years ago, which would have shared material both directly and through asteroids.
The problem with the asteroid concept, as you might guess, is a relative dearth of information. Scientists have only examined 2 percent of the Apollo samples so far, and they're all from the near side of the Moon. It's possible that further studies (especially from the far side) will tell a different story. Thankfully, those missions are coming -- the theory may get additional support in the years to come.