Just because a character is technically a villain doesn't mean everything they do is terrible.
There are plenty of anime villains who were right, even though their actions were arguably evil. Some - like Sasuke Uchiha of Naruto and Scar from Fullmetal Alchemist: Brotherhood - were victims of state-sanctioned horrors seeking justified revenge. Shougo Makishima of Psycho-Pass, meanwhile, tried to take down a corrupt government to potentially save thousands of lives, but inadvertently got his hands dirty in the pursuit of justice.
Anime villains who are pure evil can be fun, but when an antagonist has relatable motivations, the story is always more nuanced.
Scar is a survivor of genocide. His people, the Ishvalans, were exterminated en masse by the Amestrian army. His family was slain, and he was severely harmed. His villainous behavior began when he took out the Rockbells, two doctors who had been treating him. The act was thoughtless, one borne of panic. From there, Scar went on to take the lives of Amestrian soldiers who he believed deserved it because of their complicity in the conflict.
Rather than letting revenge consume his life, Scar ultimately comes to regret his actions, as he realizes hate begets hate and holding onto a grudge serves no purpose. While slaying the Rockbells was clearly unjustified, it’s hard to fault him for going after soldiers, since some of his victims were directly involved in the Ishvalan extermination.
Despite being a vicious monster, Stain is a villain with conviction. He despises professional superheroes, as he thinks they're hypocritical liars who care more about making money than actually saving people. Stain wants to deconstruct a society that values money above people's lives, so he starts slaying the pro heroes who symbolize the broken system. He's reluctant to hurt anyone who isn't a professional hero, and will only do so if he's physically threatened.
While his methods are questionable, Stain makes a good point; My Hero Academia's hero system is deeply flawed. The society's laws are convoluted, heroes don't always protect people who need help, and the whole enterprise is ruled by capitalism.
Taking the lives of the people who work for the hero system may not be the right away to get his message across, but Stain's actions do not invalidate his observations.
Lelouch is a nuanced character, so it's difficult to classify him as a hero or a villain. He commits some atrocious acts in the name of his goal, which include slaying his half-sister, betraying his friends, and lying to his followers. However, Lelouch's vision is laudable; he wants to free Japan from the iron grip of Brittainian control.
Regardless of his methods, he is right to try and dismantle colonial rule.
A 70% worldwide crime reduction is inarguably a good thing. This is what Light Yagami achieved through his work as Kira, even if he perished a villain. Light's initial intention was to create a safe world where good people could live calm, happy lives without fear. Unfortunately, he believed he was capable of determining who should live - and who shouldn't.
The power went to Light's head, and he was eventually consumed by the need to avoid apprehension. Had he taken a more subtle approach, or reserved his judgment for those who could not have been rehabilitated, he might have avoided ending the series in disgrace.