Why We Have Hair

A: Like every physical trait found in animals, human hair exists because our ancestors adapted over time to survive in their environment. The hair on our heads does provide some insulation in cold conditions, but that is probably only a part of the story.
Evolutionary Loss of Body Hair
Our earlier ancestors had much more hair over most of their bodies. Humans eventually evolved to have considerably less body hair than our ape relatives. Scientists believe that this change was probably related (at least in part) to the need to regulate our body temperature.As our ancestors became increasingly active in hot environments, having less body hair, paired with our ability to sweat efficiently, would have made it easier for the body to lose excess heat. On top of that, shedding thick body hair reduced the living environment of parasites like lice and ticks. At the same time, the fine hair remaining on our skin still serves as a sensory early-warning system against bugs.
It is unlikely that we lost most of our body hair simply because we learned to make fires, build shelters, or wear clothing. Those technological advances would certainly have made body hair less important for keeping warm, but the major reduction in human body hair appears to have occurred much earlier. Researchers still debate exactly why humans became relatively hairless, and factors such as heat regulation, parasites, and sexual selection have all been proposed.

Why Hair Retained in Specific Areas
Hair remained in certain places because it may have continued to serve useful purposes. Eyebrows and eyelashes form a protective threshold that stops salty sweat, dust, and rain from dripping directly into our eyes. The hair in the armpits and groin may help lessen the skin-on-skin friction caused by walking and running. It may also have played a role in trapping or spreading chemical signals (pheromones) indicating health or maturity. But scientists do not have a definitive answer yet for why humans retained hair in these particular areas. So, these ideas remain well-reasoned possibilities rather than absolute facts.The hair on our head is a little different. The scalp may have retained hair because hair can provide insulation in cold weather, but there is good reason to think that scalp hair primarily helped our upright ancestors deal with intense tropical heat. When humans began spending more time standing and running on two legs, the top of the head became the surface most directly exposed to solar radiation. Hair acts as a solar shield to keep the brain cool, reducing the physical effort your body has to spend on cooling itself down through sweating.
There is also a possibility that scalp hair was influenced by sexual selection. Hair can be a visible signal of a person's age, health, sexual maturity, and overall condition. Characteristics such as hair length, thickness, and appearance may have influenced mate choice. But this is only one piece of the puzzle, and it is difficult to say exactly how much sexual selection contributed compared to thermal regulation.
©Hairfinder.com
See also:
Why men prefer long hair
Does a man's hair grow faster than a women's hair?
Hereditary hair color and how parents determine a baby's hair color