The physics of why the heated metal glows like a black body has already
been thoroughly covered in the previous answers. However, in order to
completely bridge the gap with the physiology of color perception (which
has been alluded to in some answers), it is worth showing a picture of
the Planckian locus:
Plot by PAR, from Wikimedia Commons
This is the set of all the colors a black body can have, plotted in a
chromaticity diagram. It is computed by combining the black body
emission formula with the color matching functions, which
are a mathematical model of our color vision.
This graph clearly shows the path of a black body going hotter: red
→ orange → yellow → white → blue. Now, one may
wonder by which coincidence it hits right into the white, rather than
going slightly above (through the greens) or below (through the
purples). That question, however, is backwards. The good question would
be “Why have we chosen to name ‘white’ a color from the Planckian
locus”. This is the question of the definition of white, and it is not
straightforward.
In the physicists jargon, the name white is often used to mean a “flat
spectrum”, i.e. one in which the power per unit frequency does not
depend on the frequency. When talking about actual visible colors,
however, it has a completely different meaning:
- A surface is said to be white if it bounces back almost all the
visible light that is shed to it.
- Light is said to be white if it looks like the light typically
coming from a white surface.
This leaves the notion of while light ill defined: the light coming
from a white surface has the same spectrum as whatever illuminant
(meaning: light source) was shined to it. Then the light from any
typical illuminant could be considered, in some sense, to be “white
light”.
In practice, in the realm of color science, there are some so called
“standard illuminants” which are deemed white. Most notably D65 and
D55. These are meant to model natural daylight. The choice of daylight
as a reference light source is obvious given that our species has
evolved in a world where daylight has always been the standard light
source, and thus our natural white reference.
The spectrum of daylight varies with the weather and with the height of
the sun above the horizon, but it is never too far from a black body
spectrum. Which is probably not very surprising given that the Sun
itself is a pretty good black body.