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! tormented 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 slays hundreds of people, eventually betraying a person he loves in one of the most egregious ways possible.
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.
Thanks to acquiring an immortal vampire body, Haruto Tokishima sometimes loses control of his own behavior when he goes into a berserk state known as "Possessed Parastica Vampire." While in this state, he sexually assaults Saki Rukino, one of his friends. Knowing Haruto would never do something so terrible intentionally, Saki forgives him, but it drives a wedge between the two nevertheless.
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.
Katsuki Bakugo may attend a high school for training would-be heroes, but his behavior often falls short of what you might all heroic. Bakugo torments his childhood friend Izuku for years, publicly insulting, screaming at, and even fighting poor Izuku. Motivated by directionless rage, Katsuki constantly misinterprets Izuku genuine care for his well-being as a form of belittlement. I
f Katsuki actually wants to be a professional hero, a person worth looking up to, he needs to go about refining more than just his powers.
Itachi Uchiha's misdeeds are simultaneously the most reprehensible and the most understandable in all of Naruto. He slays every single member of the Uchiha clan except for his younger brother, Sasuke, then uses genjutsu to force Sasuke to re-watch every moment of the event that he'd missed. He tells the 8-year-old that he did it to test his own abilities, and for most of the series, that remains the only explanation.
Later in the series, it is eventually revealed the city government manipulated Itachi into taking out his family. The government says Itachi must slay them all (except Sasuke) or else they will come and mow down his family themselves. For a 13-year-old boy who already suffered PTSD thanks to a conflict-torn childhood, Itachi isn't exactly in a state to refuse, or even understand his actions. He commits terrible acts, but the reasoning behind them makes it difficult to hold it against him.