Most of the early missions, such as the [Ranger missions][1], mostly just aimed to get to the moon.  Before our understanding of orbital mechanics was as good as it is today, and before computers were powerful and compact, just getting something to the moon was a huge challenge.  Many of these early programs were testing to see if we could even get to the Moon.  Notice how two of the Ranger missions missed the moon entirely.  These missions were meant to test whether or not we could accurately reach the moon, and they contained no devices for slowing down and getting into orbit, as that was beyond our ability at the time.  Instead, they simply crashed into the surface, taking as many pictures as they could on the way down and relaying them back to base.

Some of the later missions, such as the [Lunar Prospector][2] were intentionally crashed in order to find out more about the lunar surface.  In the case of the Lunar Prospector, its collision with the moon was aimed specifically at a shadowed crater rim, so that spectrometers could analyze the rock and dust it kicked up, looking for water.

Other spacecraft that are listed as having intentionally crashed into the moon are objects that were merely used as boosters, such as the [Apollo S-IVB][3].  The rest are satellites that were deorbited to prevent them from crashing uncontrolled into the lunar surface, possibly damaging important sites.


  [1]: https://en.wikipedia.org/wiki/Ranger_program
  [2]: https://en.wikipedia.org/wiki/Lunar_Prospector
  [3]: https://en.wikipedia.org/wiki/S-IVB