Please note that this is about domestic cats which changes the answer slightly. Perhaps the first reason why domestic cats might attack humans is because they are not fully socialised. If a domestic cat is not fully socialised to people she may be fearful of them and if so, if approached by a person, particularly a stranger, they may strike out in defence. Fearfulness leads to defensiveness which in turn leads to a slap or a bite. This is not a wanton, willing attack by a cat on a person but a defensive action. We have to remind ourselves that domestic cats are much smaller than us. We appear as large potential predators to domestic cats unless they are fully socialised. This affects their behavior and relationship with humans.
Another instance when a domestic cat might attack or appear to attack a person is if they are being petted too vigourously by their owner or another person. Over-petting can stimulate a play impulse in an adult domestic cat. When domestic cats play, particular kittens, they roughhouse and play quite hard which includes biting. It can hurt and sometimes domestic as don’t know the limits of how hard they should play. In these circumstances a domestic cat might hold onto a person’s hand with their forelegs and rake the hand with their hind claws. The more the person struggles, the worse it gets. The best solution is to distract the cat with the free hand and remove the trapped hand slowly and gently.
If a person approaches a fully socialised domestic cat in a public area, and the cat does not know the person he may be fearful of them. If the person insists on approaching and trying to pet the animal they may strike and attack the person. The attack will be accompanied by a viscious hiss.
Probably related to @catturd2
Cat don’t take no shit..
— Gorilla Warfare (@RightTheTorch) October 18, 2019
If a person is aggressive towards a cat such as throwing something at a stray cat to get rid of him or her and persist in doing this, the cat might strike back under exceptional circumstances. I remember seeing a woman kicking snow into the face of a stray cat, or it may have been a neighbour’s cat. She did this persistently until the cat lost his cool completely and lept at her face from the ground. He slapped and bit her face. She screamed in shock, horror and pain. She walked inside her home distressed. This is what can happen if you are aggressive without cause towards a domestic cat!
Exceptionally, picking up a cat who is injured or ill may cause the cat to strike out because the human action caused the cat to feel pain. The cat might perceive this as being attacked by their owner and therefore they return the favour.
Transferred aggression is another reason why a domestic cat might attack their owner or another person. This happens when the cat is wound up by something that might have happened outside. The cat wanted to attack another cat or animal but was too fearful to do so and ran inside. The cat encounters their kindly owner and in a moment of mad impulse bites their lower leg to release the desire to attack which has not been fulfilled. This rarely happens and it looks like a wanton act of aggression but it is not.
A visitor to the site, Cindy, believes that she is a survivor of an attack by her cat who suffered from feline feline hyperesthesia. She refers to a Cornell article on the condition which does not mention that it causes attacks on people. If anything, the cat attacks itself such as chasing their tail. I suspect in this instance, Cindy perhaps tried to pick up her cat that was going through an episode of feline hyperaesthesia and her cat redirected their obsessive-compulsive disorder symptoms against her. She says that her cat was a loving lap cat. Rather mysteriously, she states “I wish I had known the symptoms and maybe prevented the nightmarish ending for me and my 16 year old, loving lap cat”. That implies that her cat has passed over of the rainbow bridge in an unpleasant way.
It would be highly irregular and exceptional for a domestic cat to wantonly and willingly attack a person without apparent reason. This is because the human is not a prey animal for the domestic cat. Therefore, we have to conclude, that the only reason, other than play induced biting, why a domestic cat attacks a person is because it is a defensive action.
I have written this without reference to any information so if I’ve forgotten something please tell me in a comment.
Please search using the search box at the top of the site. You are bound to find what you are looking for.