Most petting bites are not aggression. They are overstimulation, and cats give a predictable sequence of warnings before the teeth.
Cats bite for five main reasons: play, overstimulation, fear, redirected arousal, and pain. Which one you are dealing with depends.