A blackbody is an object that absorbs all incoming light without reflecting any, thus appearing black at room temperature (hence the term blackbody). However, all the energy a blackbody absorbs must be released in some way. When it is at thermal equilibrium with the environment, i.e., no thermal energy being released, the energy absorbed has to be emitted out as electromagnetic waves.
Note that a perfect blackbody doesn’t exist in reality. But it is possible to construct a nearly-perfect blackbody. For example, a completely closed box made of a thermally conductive material, such as metal, with a small hole somewhere on the wall can be treated as a blackbody. Light going into the box through the hole will bounce around inside the box and eventually absorbed completely with little chance of escaping from the hole. When heated up, electromagnetic waves coming out of this hole will almost perfectly resemble that from an ideal blackbody at the temperature of the air inside the box. Furthermore, the thermal radiation spontaneously emitted by many ordinary objects can be approximated as black-body radiation.
Surprisingly, scientists have observed that the radiation spectrum of all blackbodies depends only on the temperature that the blackbody is at, regardless of its composition or energy absorbed. The spectrum has a peak that shifts to higher frequencies with increasing temperature, and at room temperature most of the emission is in the infrared region of the electromagnetic spectrum. As the temperature increases to about 500 oC, black bodies start to emit significant amounts of visible light. Viewed in the dark by the human eye, the first faint glow appears as a “ghostly” grey (the visible light is actually red, but low intensity light activates only the eye’s grey-level sensors). With increasing temperature, the glow becomes visible: first as a dull red, then yellow, and eventually a “dazzling bluish-white” at very high temperatures. When the body appears white, it is emitting a substantial fraction of its energy as ultraviolet radiation. The Sun, with an effective temperature of approximately 5500 oC, is an approximate black body with an emission spectrum peaked in the central, yellow-green part of the visible spectrum, but with significant power in the ultraviolet as well (which is why we need sun screen).
The question is, why is black body radiation spectrum in such a shape? At the beginning of the 20th century, many scientists studied this problem. It was Max Plank, who eventually gave the correct answer, which led to the development of quantum mechanics.