Some Transformers lore:
The Decepticons weren't the bad guys at first. Their homeworld was based on a Cast system, and the elites decided wether you got a name and what would be your duty. This worsened after the age of rust in which leaving their homeworld became impossible (due to a pandemic called the rust)
By then, bots weren't given names and just sent to basically slave work, they would work in horrible conditions in contaminated cities that even damaged their eyes, lived in dangerous slums where their body parts were sold in the black market when they died, etc, etc. So the "poor" people didn't have any rights whatsoever, zero (I am telling you, they didn't even have names!)
Then, middle and upper class became really bored so they set up coliseums for slaves to fight; which they did mostly out of free will. But why? Well, the coliseums were the only place were low class bots could get medical attention and cared about if they won. This was Megatron's case. Megatron was named by the crowd "Megatronus" as one of the primes and he just stuck to that name then. He became an advocate of equality and eventually reached the council where he suggested that the elite should be taken out by force. This is told as something bad, but the elite was pretty petty and the situation of the low class bots was indeed quite harsh.
Now, Decepticons are evil now because their minds got corrupted by a drug that they used to enhance their power (kinda like steroids but way stronger). I am not sure if it was Megatron who accidentally corrupted the God and other Decepticons with this drug or what. But yeah, they were at first just rebels, slaves that wanted freedom