Dr. Ivo "Eggman" Robotnik is the main antagonist of Sonic the Hedgehog. He is a brilliant, but menacing scientist who wants to conquer the world, or is he not that bad? This theory gives out evidence on how Eggman isn't really a bad person.
Eggman doesn't like destruction.
Eggman likes to conquer the world and turn it to his own empire, but he doesn't choose to destroy it, unlike most villains such as Lyric(from the infamous Sonic Boom: Rise of Lyric), the Deadly Six(from Sonic Lost World), Dark Gaia(from Sonic Unleashed), and Mephiles(from Sonic 06). He also hates Sonic but would rather not kill him, since he thinks killing someone is simply going too far.
The only act of destruction he did was stealing the earth's energy to fuel up one of his ultimate weapons in Sonic Lost World and for controlling the sun to destroy the planet in Sonic Forces.
Eggman never gives up
This may be a pretty good explanation. Even though Eggman always loses a battle, he always finds a way to stand back on his heels. Eggman usually develops another master plan or he goes to find another villain he can accompany with. Most villains simply fall into despair and/or death, but Eggman always keeps trying to fight down Sonic no matter how hard it becomes.
He's not selfish
In most games, Eggman will team up with another villain to stop Sonic, but by the next minute the villain turns their back on Eggman. First it was Chaos(who's an anti-hero), Shadow(who's also an anti-hero), Metal Sonic, Dark Gaia, The Deadly Six, and Lyric. All these villains who betrayed them were self-absorbed and thought it was better to accomplish goals by themselves.
Eggman also cares about his robots and will always make new ones to restore his glory and pride. Unlike other villains, Eggman believes that working with others will make them grow stronger than doing it alone.
Compared to Eggman, Sonic has become more selfish in the later games(excluding Sonic Boom, Sonic Mania, and Team Sonic Racing). He is seen to not trust anyone but himself and his classic version. This is probably the main reason why Sonic is the only playable character in most Modern Sonic games.
He Doesn't Really Hate Sonic
In several games and TV shows, there are some moments when Eggman is nice to Sonic and his friends.
In Sonic Adventure 2, Eggman and Tails agreed to work together in saving their world from destruction. In Sonic Heroes, he influences the leading characters that only the Chaos Emeralds can destroy Metal Sonic. In Sonic 06, Eggman helps Sonic's friends to find the emeralds to save Sonic and destroy Mephiles and Iblis. In Sonic Boom: Rise of Lyric, Eggman kills Lyric from trying to destroy Sonic and his friends along with the Earth's nature.
The Government from SA2 are the real villains
Eggman's grandfather, Gerald Robotnik, was a rather kind scientist who wanted his grandson to be a brilliant as him. He created Shadow as a lifeform of protection and heroism, but the government convinced Gerald to make Shadow a weapon of evil, but Gerald refused to do something vile as this. The government planned to steal Shadow and arrest Gerald and his lab workers, and also to murder his granddaughter, Maria(who was Eggman's cousin). The government arrests Gerald, as Gerald is forced to commit acts of evil. The government is technically a negative influence to Eggman.
Eggman's diet is healthier than Sonic's
Although he's not skinny or athletic than Sonic, it doesn't seem that Eggman doesn't have an unhealthy diet. It's unknown what's his favorite food, but there are some scenes where he's eating eggs and a submarine sandwich, which are healthy foods.
Meanwhile, Sonic is more obsessed with junk food such as McDonald's Happy Meals and is addicted to chili dogs, which neither are nutritious for his body.