Humans have Child Ego States (think limbic system) and Parent Ego States (think Higher Cortical Functions).
Limbic Systems subconsciously motivate us to act out natural behaviour, including eating, quenching thirst, seeking warmth and comfort, physical and emotional affection, sex, love, joy, but also hate, anger, rage, jealousy, possessiveness, infidelity, fear and shame, sadism, etc.
The majority of unlawful behaviour is motivated by the Limbic System. It's a psycho-emotive problem. Teenagers (who have underdeveloped prefrontal cortices), and people with mood disorders and personality disorders (which involve the limbic system) make up a significant proportion of offenders.
The Higher Cortex evolved as a mechanism to "steer" feelings of the limbic system in the right direction and aid survival. But it sometimes fails.
In some individuals the Higher Cortex becomes Oppressive and Prejudicial. An example currently in our awareness is religious fundamentalism. Such a mental state would banally sign a torture certificate as if signing an invoice for office supplies, or approach the slightest transgression with outrageous punitive response. Even worse is an oppressive Parent Ego State that will sometimes "reward" the Child Ego State's obedience by letting it out to "play", often sadistically.
That is my "Transactionalist" perspective on where our capacity for "evil" comes from.
_________________
Life is Painful. Suffering is Optional. Keep your face to the Sun and never see your Shadow.