There is very little atmosphere around the moon. The atmosphere of the Earth acts like a blanket surrounding the planet. All energy on Earth initially comes from the sun (in the form of electromagnetic radiation such as ultraviolet, micro, gamma, light, x, and other waves). Some of this energy is kept from reaching the surface of the Earth by its atmosphere. This prevents the Earth from becoming too hot. The energy that does enter, hits the surface of the Earth and then reflects off of it and bounces upwards. Some of this energy is then lost to space. However, some of it reflects off of the upper atmosphere and returns to Earth. This phenomenon is called the greenhouse effect. If there are pollutants in the air, then the greenhouse effect occurs in all directions (as opposed to a ricocheting up and down) and can cause global warming.
Becuase the moon contains little to no atmosphere, there is no "blanket" to prevent the energy from entering on the side of the moon that is facing the sun. Likewise, there is no atmosphere to help keep energy in. Thus, when compared to the temperatures of Earth, the temperature differences are much more drastic on the side of the moon that is facing the sun than the side of the moon that is facing away from the sun.