For a genre often associated with beloved heroes like Sailor Moon or Goku, anime often makes their protagonists commit horrible atrocities. Unlike anime that follow villains, anime with complicated heroes do not necessarily set out to create sympathetic characters; some of these "heroes" are just not great people. Some anime heroes who did something bad have one or two minor transgressions on their rap sheet. Joey Wheeler of Yu-Gi-Oh! bullied Yugi for about two episodes, but he gets his act together and becomes a good friend. Other morally ambiguous anime good guys commit more serious misdeeds, ones that can be hard to overlook. Guts of Berserk kills hundreds of people, eventually betraying a person he loves in one of the most egregious ways a person can.
Anime protagonists who do terrible things can sometimes be hard to root for, but sometimes their actions serve to tell something larger about the storyline. However, that only provides justification for a few of these immoral anime heroes.
No matter how nuanced and well-developed Shinji Ikari becomes over the course of Evangelion, it's hard to overlook the moment he pleasures himself over Asuka's comatose body. Yes, you read that right; meek, little Shinji actually does that. Though he's motivated less by total depravity and more by profound loneliness and desperation, he still totally disrespects his friend in the most disgusting way possible.
Guts often uses his formidable strength to save others from various dangers including despotic power-hungry priests to literal demon attacks, but his rap sheet is long and horrible. First of all, he kills hundreds, if not thousands, of people, including children, under a staggering variety of circumstances. Though he doesn't enjoy killing, he'll do it out of necessity, and in the world of Berserk, necessity is often observed.
Though technically a hero, Guts unfortunately will unleash his cruelty on the ones he loves. One of the worst things he ever does iswhen he sexually assaults Casca, the love of his life. Thanks to traumatic events, including repeated rapes, Casca's mind is already nearly destroyed, and she can no longer speak, reason, or look after herself. Though Guts wants desperately to protect her, he still assaults her. He immediately begins feeling remorse and self-loathing, but nothing it never erases what he does.
Lelouch Lamperouge's ultimate goal involves taking down the Holy Brittanian Empire and freeing the Japanese people from its tyranny. To do this, he must kill a lot of people. None of the murders are exactly good, but one of the saddest is when he must kill Euphemia, his half-sister. Despite being part of the royal family, Euphemia supports the Japanese people and wants to create a safe zone where they may live without being oppressed by Brittania. However, Lelouch accidentally uses his Geass power to set her on a path which would end in the Japanese people being killed en masse.
The only way to prevent that outcome is to kill her, so he does exactly that. It's a particularly tragic moment, because Euphemia wants to do the right thing, and Lelouch is the one who accidentally set her on the wrong path through mind control.
Koyomi Araragi is a complicated dude. Even if he barely knows a person, Koyomi will happily go through absurd amounts of physical and emotional trauma to assist them. However, that hardly makes up for some of his seriously inappropriate acts, and he needs to be taken to task for them.
In Bakemonogatari, he repeatedly gropes, only to start physical fights, with an elementary school student named Mayoi. The fact that Mayoi is actually an Oddity doesn't make it any better – she still has the appearance and demeanor of a little girl, and Koyomi initiates these assaults before he knows anything about her. In Nisemonogatari, he holds his sister down and... erotically brushes her teeth? As has already been said, Koyomi is complicated.