When astronomers refer to the temperature of a star, they are talking about the temperature of the gases in the photosphere, and they express those temperatures on the Kelvin temperature scale. On this scale, zero degrees Kelvin (written 0 K) is absolute zero (2273.2°C or 2459.7°F), the temperature at which an object contains no thermal energy that can be extracted. Water freezes at 273 K and boils at 373 K (at sea-level atmospheric pressure). The Kelvin temperature scale is useful in astronomy because it is based on absolute zero and consequently is related directly to the motion of the particles in an object.
Now you can understand why a hot object glows, or to put it another way, why a hot object emits photons, bundles of electromagnetic energy. The hotter an object is, the more motion there is among its particles. The agitated particles, including electrons, collide with each other, and when electrons accelerate—change their motion—part of the energy is carried away as electromagnetic radiation. The radiation emitted by a heated object is called black-body radiation, a name translated from a German term that refers to the way a perfectly opaque object would behave. A perfectly opaque object would be both a perfectly efficient absorber and a perfectly efficient emitter of radiation. At room temperature, such a perfect absorber and emitter would look black, but at higher temperatures it would glow at wavelengths visible to a human eye. That explains why in astronomy and physics contexts you will see the term black-body referring to objects that glow brightly.
Black-body radiation is quite common. In fact, it is responsible for the light emitted by an incandescent light bulb. Electricity flowing through the filament of the bulb heats it to high temperature, and it glows. You can also recognize the light emitted by hot lava as black-body radiation. Many objects in the sky, including the sun and other stars, primarily emit black-body radiation because they are mostly opaque.
Credit: Michael A. Seeds, Dana E. Backman
Gif credit: caucasianmale