Basically, the hotter an object is, the shorter the wavelength at which it will emit radiation.
For example, the surface temperature of the sun is 5780 K, giving a peak at 500 nm. As can be seen in the article Color, this is fairly in the middle of the visual spectrum, due to the spread resulting in white light. Due to the scattering of blue light by the atmosphere this white light is separated somewhat, resulting in a blue sky and a yellow sun.
A lightbulb has a glowing wire with a somewhat lower temperature, resulting in yellow light, and something that is "red hot" is again a little less hot.
Today we derive the law from the Planck's Law of Radiation.
See also: Wien, Wilhelm