Hi. Hair probably evolved millions of years ago in the very first mammals. Its thought that it evolved from the scales of reptiles.
It serves many purposes, but one of the major ones is warmth from the cold in winter and protection from the sun in summer. It also is used for communication in some species (animals have patterns on their fur) and also camouflage. Other special hair such as your eyelashes and eyebrows evolved to protect your eyes from dirt and sweat.
At some point during evolution we humans must have got rid of the thick hair that animals like chimpanzees. Something must have triggered us getting rid of the majority of the hair. Some scientists think that when our ancestors started to walk upright, it was no longer necessary to have hairy bodies and very hairy heads were all that were needed to protect us from the sun. Other theories include the idea that we lost most of our body hair because of too many parasites (that thrive in thick hair). Scientists aren’t sure why we’re mostly non-hairy now.