Your cat is exhibiting a bonding behavior. In the nest, cats frequently groom each other to create one familiar "nest scent." They also groom out of affection and as a way to strengthen their bond. When you're scratching or petting your kitty's head, he's probably connecting that with being groomed and begins grooming you in return. Enjoy this act of love and affection.
More cat-care and behavior solutions: