They emit light because, when you heat something up you are giving it energy. Most of this energy becomes kinetic energy of the particles (i.e. making them move faster) however some goes into the electrons. When the electrons receive energy, they take a "quantum leap" up to a higher orbital of greater energy. The atom cannot stay in this "excited" state, and so the electron must drop back down to its original orbital energy level. In doing this it must release the energy. It does so by emitting a photon. This photon is normally infra-red, or to the red end of the visible spectrum, because the "energy gap" between the orbitals (i.e. the energy released by the electron in the form of a photon) happens to correspond to frequencies around the red/infra-red part of the electromagnetic spectrum. You don't really get higher frequency photons being emitted, because at those energies the atom would get completely ionized (i.e. stripped of all electrons) before an electron orbital energy gap could get that big.
making a small donation to science.ca.