A complex villain is always more interesting than a one-sided evil that has no underlying motivation.
Sometimes, the villains are even sort of in the right--the heroes keep the peace for the sake of keeping the peace, but are they really doing the right thing? Or would the villain have been better winning?
Here were some of those answers.
Ed Harris's character in The Rock. Ex-vet wanted a decent funeral for some of his fallen comrades plus I think a 100 mil in compensation for their families
Spoiler alert: the president said no
Who Went First
The Machines in the Matrix.
The Second Renaissance showed that it was humans who struck first and tried to destroy the sentient Machines once they became intelligent. The Machines removed themselves from society and created their own city 1-0 in the middle of the desert to try to allay human fears but it still didn't work.
Humans were the aggressors. The Machines wanted to protect themselves.
And the Machines are not even evil. Instead of just exterminating humans or chopping off their heads and using their bodies as batteries they took the trouble to create a massive virtual world for us. They even tried making it a Paradise at first (according to Agent Smith) but we rejected it so they went more realistic.
Protecting Your Kind
Magneto. Having been a Holocaust survivor, it makes a lot of sense to not want to see the people you identify with once again persecuted for the circumstances of their birth.
Luke Castellan from Percy Jackson. His motivation was that the gods didn't pay enough attention to their kids (himself included) and wanted the gods and Camp Half-Blood to recognize the children of the minor gods.
When American Healthcare Is The Real Villain
Sandman from Spider-Man 3. He just wanted a chance to see his dying daughter before she died. The only reason he robbed places was the get enough money to find treatment for her. He accidentally killed uncle Ben, and felt really bad about it, to the point where it haunted him.
For The Greater Good
He has literally, like without a shadow of a doubt seen every single outcome of every single decision he has or will ever make. And the only way humanity survives is if he rules them and takes them on a certain path.
Yet the fantastic four keep on beating his ass down.
His rule isn't even that bad, even in the context of 'a great leap forward.' The FF just don't like him because he's just a power hungry single leader and being that and ruling the earth has historically been bad. But you know what all those other populist leaders didn't have? LITERAL DEMONSTRABLE CLAIRVOYANCE AND SUPER INTELLIGENCE.
My Life Is Over
Zemo from Captain America Civil War. Superhero battle kills everyone he cares about, destroys his city and sets his country back to the Stone Age. Then they just go home. Zemo targeted the avengers and set them up to turn on each other. A man with no powers was able to beat the Avengers.
He saw the lies that were being spread, the fact that those in charge were harming humanity, and wanted to make a change which, okay put him in charge, but also lead to actual change for the people.
Also, Captain Hammer is a jerk.
The EPA guy in Ghostbusters was just trying to make sure their weird new technology was safe but the quippy nerds refused to comply. Turns out they didn't even have a backup generator for if it ever got unplugged.
Javier Bardem's character in Skyfall. Betrayed and abandoned by his own country, and subjected to years of torture. Hell, the same thing happened to Bond at the beginning of Die Another Day, but MI6 eventually got him back whereas they just forgot Silva existed.