All objects emit electromagnetic radiation according to their temperature. Colder objects emit waves with very low frequency (such as radio or microwaves), while hot objects emit visible light or even ultraviolet and higher frequencies.
Blackbody radiation is a term used to describe the relationship between an object's temperature, and the wavelength of electromagnetic radiation it emits. A black body is an idealized object that absorbs all electromagnetic radiation it comes in contact with. It then emits thermal radiation in a continuous spectrum according to its temperature.
Blackbody radiation curves for a gamma ray burst, the Sun and a brown dwarf. Image credit: LCO
Stars behave approximately like blackbodies, and this concept explains why there are different colors of stars. Red stars are cooler, and they emit the most radiation in the red wavelengths. A hotter star like our sun emits the most radiation in the yellow/green part of the spectrum.
We don't see any stars as green because stars with peak wavelengths in the green also emit lots of radiation in the red and blue part of the spectrum. Our eyes combine all of these colors and we see white in this case. Even hotter stars and other objects emit the most radiation in the blue, ultraviolet or even x-ray and gamma ray part of the spectrum. Objects like these appear blue to our eyes. Much cooler objects like planets and humans emit the most radiation in the infrared. Even cooler objects emit microwaves and radio waves.
The diagram above shows blackbody curves for a gamma ray burst, the Sun and a brown dwarf. Gamma ray bursts produce a huge amount of energy, and in addition to the gamma rays produced, it gives off elecromagnetic radiation from the rest of the spectrum. We see some of this as visible light. A star like our Sun produces the most energy in the yellow/green part of the visible spectrum. It also produces ultraviolet and infrared, though in smaller amounts than the visible region. A cooler object like a brown dwarf emits most of its radiation in the infrared.
The video below explains more about how a star's color is related to its temperature, and why we don't see green stars:
Why aren't there any green stars?
This animation shows the relationship between the temperature, peak wavelength and intensity of light from a black body.