I think it's one way of marking its territory cause they have scent glands in their paws. It comforts them also. That being said, don't punish your cat for doing this. It won't understand why
My cat does this sometimes. I don't like it because she seems to need to do it on my chest and stomach, where she can see my face. And her claws hurt, particularly on those areas.