In the days of old, especially in the eighteenth century, protagonists were heroes and antagonists were villains, and they were often depicted in stories as either good or evil, clearly delineated.
Anti-heroes developed as characters in whom the strengths and the flaws compete, making for a character that constantly engages and challenges the reader.
An anti-heros will:
have easily identified imperfections
be made understandable by the story events, meaning that the reader will come to know their motivations
have a starring role in the story
Occupy a grey area between good guy and bad guy
can be selfish but occasionally are good
can be motivated by self-interest and self-preservation but there is usually a line they won’t cross
When forced to choose between right and wrong, will sometimes choose wrong because it’s easier
Can embody unattractive traits and behaviours, such as sexist and racist attitudes, and violent reactions when wronged (difficult to write if you find such views abhorrent but if that‘s the way the character is…)
Can show little or no remorse for bad behaviour.