Anime fans don't exclusively love characters who are good people. In fact, there are a ton of beloved anime characters who are bad people. This doesn't mean that they're bad characters - some of them are among the best anime characters ever created. What it does mean is that they've done some seriously messed up things.
Sometimes, it can be frustrating when other fans love a character whose bad behavior makes you cringe. This is most common when people let the character's bad traits slide. Sometimes they may also celebrate the character as if they're some kind of saint - if you were grossed out by Miroku's wandering hands, you probably aren't super thrilled about the Inuyasha fandom's fondness for him.
At other times, it's the character's motivation that makes them fascinating - Revy from Black Lagoon may be a vicious mercenary, but the reasons for her bad behavior actually make a lot of sense. Viewers might also delight in the badness itself - watching Hisoka do his thing is one of the most fun parts of H X H.
It's pretty obvious that Hisoka is a terrible person - he specifically doesn't care about being good. In fact, Hisoka's priorities include fighting and putting an end to anyone who presents an entertaining challenge to him. This means that he'll sometimes help out the good guys, but will happily turn on them whenever it's convenient.
Moral considerations are utterly foreign to him. Despite this, plenty of fans adore Hisoka. His utter inability to care about anyone besides himself is kind of oddly refreshing, and his clown aesthetic is by turns terrifying and delightful.
When most people make moral judgments about the cast of Death Note, they're talking about the protagonist, Light Yagami. Sometimes, they're even talking about his rival - the great detective L. What people usually aren't talking about is Watari - a character who seems to enjoy near-universal respect from the fandom. He doesn't deserve it.
Why? Watari is in charge of Wammy's House, an orphanage that rounds up brilliant children and trains them for the lofty position of L, the greatest detective in the world. The kids get so ravenous and stressed about it that in the early days of the orphanage, one of them ends their life and another starts taking other people's. Watari has L working around the clock starting at age eight - it's obvious that L has never had anything resembling a normal childhood, and he has become an emotionally maladjusted adult who survives on cake and not sleeping.
Also, while it's not confirmed that Watari came up with the idea regarding L's unorthodox methods of getting information, he has no objection whatsoever to helping him. Watari seems like one of the more innocent members of the anime's cast, but he truly is not.
When fans think about characters in Code Geass who have done terrible things, they usually think of Lelouch - the anti-hero protagonist - or villains like Charles zi Britannia, Lelouch's father. They don't usually think about C.C., the green-haired immortal who delights audiences with her snarky attitude and pizza addiction.
C.C. is an enjoyable character to watch because she's charming and sympathetic - it's hard not to feel bad for her when she's been shunned because her immortality had led people to believe she was a witch. But C.C. also did something egregiously terrible that she's never truly taken to task for.
Years before she met Lelouch, C.C. gave the Geass powers to Mao, an orphan child she found on the street. She developed a parent-child relationship with him while also apparently becoming his lover. When Mao loses control of his Geass's powers and starts hearing other people's thoughts constantly, he's driven completely mad. Because C.C. has been one of the most important figures in his life since early childhood and her thoughts are the only thoughts he can't hear, Mao gets far too clingy, so C.C. leaves. Eventually, Mao comes back even more deranged than before, ready to eliminate anybody who gets near C.C. so that he can have her back in his life.
Mao comes off as creepy - but that's only before you know his history with C.C. In fact, C.C. took on responsibility for a child, gave him powers he couldn't control, and then abandoned him when the behavior she instigated got to be too much - it's hard to fault him for wanting to find her again. In the end, C.C. slays Mao, and then the issue never comes up again. Ultimately, C.C. goes back to being a fan favorite.
Accelerator is one of the most beloved characters in A Certain Magical Index, but it's not because of his good deeds. He's a cruel and sadistic psychic who wants to be stronger than anyone else, and he isn't afraid to step over others to earn that distinction. In fact, he takes out 20,000 people in an attempt to prove his strength. His backstory is a tragic one - thanks to his extreme strength, he's endured cruel experimentation that led him to the conclusion that being the strongest is the only way to keep himself safe and isolated.
At the same time, he genuinely does want to prove himself superior for the sake of it, and he demonstrates glee when he defeats powerful enemies. He's a complicated character who's hard not to root for - but it's equally difficult to ignore his body count.