Cats learn their grooming behavior as kittens from their mother grooming them.
There’s a good chance that licking your hair is a way of claiming you as their territory.
Many cats will groom to relieve stress, which is also why you’ll see cats grooming themselves right before they lay down for a nap.
Cats will spend about 30%-50% of their time grooming themselves. Grooming keeps their fur and skin healthy and keeps them cool on hot days.
Licking your hair shouldn’t cause them any harm, as long as all that’s in your hair is natural oils.
Whilst grooming is quite a sweet gesture and most cats will do it because they love you and want to make sure you’re clean.