Cats are much more independent than dogs and they will soon tell you when they want to be left alone.
It is usually better to let your cat initiate any petting and become aware of his gestures that are warning you to stop.
There are various reasons why a cat might bite its owner during petting; it could be that it is injured or ill.
Observe its behavior in case there are other symptoms and gently check for lameness. [Cat Behavior]
The signals your cat gives out are pretty easy to read if you take the time, exaggerated tail movements, muscle tension and the flicking of ears all meant as warnings to stop. A happy cat purrs but a grumpy one does not so take your cue if you want to avoid a nasty scratch.
Just like children, kittens should be given boundaries and discouraged from rough play from an early age. If not a playful kitten will soon become a cat that is a real handful, biting and scratching to its hearts content.
With cats, they have to build up a lot of trust and some simply do not like being petted which is why it is crucial to never approach a strange cat and attempt to pet it. You might end up with a nasty scratch and for young children this can create a real fear of cats.