With the advent of it's aligned continuity the nature of the war between the Autobots and the Decepticons changed. No longer was it simply Megatron the warmonger wishing to claim rule over cybertron or whatever, but conflict born of inequality and the desire for change in a rotten system (I'll be focusing on Prime and ONE for the most part but I believe this holds for all works within the aligned continuity). Under this new continuity Megatron is a bot born into the lower casts of cybertronian society. In prime (one of the first shows featuring the new aligned continuity lore) he's a gladiator with no name till he's christened Megatron by his fans, a name derived from the prime Megatronus due to their sharied strength and ferocity in battle. As a gladiator of great fame and stature yet still a member of the lower cast, he uses his potiton to bring attention to their troubles and treatment. Doing so he enters the world of politics where he meets and befriends Orion Paxs (pre matrix Optimus Prime) a data cleric. The two desired the same thing, equality for all bots on cybertron. But they differed on how to make this happen. Orion desired to change the system from within, while Megatron desired to destroy the currenty system and create a new one. When the chance presents itself the two present their ideas to the high council where they choose the Young Orion Pax's idea over Megatron's. Thus dividing the two and eventually sparking the war between them.
Transformers one even has the two both apart of the lower cast, they journey together and yet differ on how to simply move forward (they're obvioulsy not the same person, but they struggle to even see eye to eye). D-16 wants to KILL Sentinel Prime after learning the trouch (Man had his world destroyed in a day), where Orion wants him to face justice (Won't lie, Sentinel should be tried of course, But I don't think D-16 is wrong for wanting to kill the person that's confined him to a life of slavery upon birth, created a system where bots like them, Miners had no mobility / power, and killed the 13 Primes for power all to end up serving energon to the quintessons. Something that does not flow freely anymore due to his actions). After finally killing Sentiel he processed to destroy everything around him, tearing down all Sentiel has built, desiring to create a new system in its place (He will no longer be lead by false profits, He will be his own leader).
This is realitivly the bases for the aligned continuity, greatly simplifying you have Optimus and Megatron who'll desire the same thing then differ on how to execute.