Cats rub against people's legs as a way to show their affection and mark their territory. Cats have scent glands on their cheeks and forehead, and when they rub against something they are depositing their scent. This is a way for cats to show their affection and also to mark their territory.