The colours are a result of particular chenicals such as eumelanin (black and brown), pheomelanin(red) and melanin (less melanin = darker hair). Melanin is also responsible for dark skin tones and for tanning.
There are no proteins in human hair that emit green light, and very few humans with chlorophyll in their hair.
At present the best explanation has to do with the hair's role as a photoprotective element. That is, it blocks too much UV from irradiating the scalp. Why don't all people have black hair then, after all that would be the "safest" thing from the point of view of UV protection?
Turns out some UV is needed for Vitamin D synthesis. Thus some UV must get through, if too much is blocked probability of survival goes down. The lighter hair colors allow more UV through, the darker colors less. So, evolution "selected" darker hair in areas of high UV intensity and visa versa.
This doesn't explain all the subtleties of hair color though, i.e. the variations seen in the absorption spectrum across the visible band. There is more to the story but all the facts aren't in yet in that regard. This, to me, suggests there remains something to be learned about the photophysiology of visible light on humans.