This is from PetMD
Trying to understand a cat's behavior can be downright maddening. Oftentimes, feline actions are dictated by stress and fear but fortunately, one cat behavior in particular usually comes from a good, friendly place. When your cat rubs up against your legs or pushes his head against you, it's a very positive sign.
According to Dr. Jill E. Sackman, senior medical director for BluePearl Veterinary Partners' Michigan Region, head rubbing is a behavior cats learn as kittens with their mother. It's an affectionate gesture that can also be used as a form of greeting, she says.
Learn more about the reasons cats rub against people, things and each other, below.
Looking for Information
Cats are very olfactory creatures that rely heavily on their sense of smell to give them information about their environment, says Dr. Stephanie Borns-Weil, a resident in Animal Behavior at the Cummings School of Veterinary Medicine at Tufts University in North Grafton, Mass.
When a cat rubs or pushes its head against you, also known as head butting or bunting, the cat is also marking you with his scent in a show of affiliation, Borns-Weil says. Affiliative behaviors serve to maintain a connection within a group of individuals. Head rubbing is a cat's way of marking its people and its environment and grouping them together with the same scent.
When meeting someone for the first time, a friendly cat may rub up against the visitor in greeting and as a way to get information about the new person, like where they come from and if they have animals of their own, says Borns-Weil. Whether or not this type of behavior serves as an invitation for affection varies from cat to cat, however.
"Some cats don't want to be petted but want information from you," Borns-Weil says. In other words, don't assume head rubbing from a strange cat is an invitation to be pet.
Cats also greet other cats they know with a head rub or bunt. Feral cats, who tend to live in groups, use this behavior to show their affiliation with the group and single out their "preferred associates," Borns-Weil says. When cats live together and all rub on each other, a communal scent is spread throughout the group.
Staking Their Claim
So then why do cats rub up against things in your home like the couch, table or doorway? Borns-Weil explains that cats claim objects by marking them with their feline scents.
Cats have scent glands located in their cheeks, forehead, chins, and a the base of their tail and rubbing up against people, other cats and objects is a form of marking without being a territorial action like spraying, Sackman says. It's a friendly, relaxing behavior, and in fact, synthetic feline pheromones used to help calm anxious cats are derived from the pheromones found in these scent glands, she says. Of course, scent marking doesn't last forever so a cat will frequently go back and refresh its marking.
Humans may also reinforce the head rubbing or bunting behavior when we stroke or scratch the cat's head in response, which cats enjoy, Sackman says. A lot of people don't realize that cats prefer to be scratched and stroked on their heads and around their ears and are less fond of being petted along their backs or sides, she adds, so it's entirely possible that head rubbing and bunting is also a cat's way of encouraging his people to focus on scratching and stroking his head, and leave the rest of his body alone.
I think if the cat is just rubbing against you everything should be fine. (Just my opinion) If it bites or breaks the skin … that could be a problem.
I think the cat just likes you and wants attention.