In days of old, especially in the eighteenth century, protagonists were heroes and antagonists were villains, good or evil, clearly delineated. The anti-hero blurs the lines. Take my detective Jack Harris, a force for good but perfectly capable of cutting corners to get what he wants.
So how do you create them? Here’s some thoughts. Anti-heroes:
are sometimes unattractive in character as well as in appearance
can be motivated by self-interest and self-preservation, but there is usually a line they won’t cross.
However, forced to choose between right and wrong, they will sometimes choose wrong because it’s easier but can sometimes be coerced to help underdogs, children, or weaker characters
can embody unattractive traits and behaviours, such as sexist and racist attitudes
can show little or no remorse for bad behaviour
are usually full of contradiction
Oh, and are fun to write!