The plot could be about a power struggle. Megatron wants total control over Cybertron, but Optimus Prime stands in his way. However, instead of just fighting, there are political intrigues involved. There could be other characters influencing their decisions. Maybe some Autobots who think Optimus is being too soft on Megatron, and some Decepticons who think Megatron is being too cautious.
It could be a story of redemption. Megatron realizes the error of his ways and tries to make amends. Optimus Prime is skeptical at first but eventually decides to help him. This journey of Megatron's redemption could involve them facing many challenges together. They might have to fight against those who don't believe Megatron can change, both from the Autobot and Decepticon sides.
In a fanfic about Optimus Prime x Megatron, their relationship could be explored in a more philosophical way. For example, they might debate the nature of good and evil, power and responsibility. Optimus believes in protecting all life, while Megatron has his own ideas about power and how it should be used. This kind of fanfic could show how their different viewpoints could either bring them closer together or drive them further apart.
A great angle for a Megatron x Optimus Prime fanfic could be a body - swap situation. They are forced to inhabit each other's bodies due to some alien technology gone wrong. This leads to them having to understand each other's perspectives on a whole new level. They start to see the reasons behind their actions in the past and develop a new - found respect for one another.
In a Megatron x Optimus Prime fanfic, the story could also be about a power struggle within themselves. Megatron is tempted by an ancient power source that could give him ultimate control. Optimus Prime tries to stop him not as an enemy but as a friend who is worried about Megatron's well - being. Their interactions are filled with emotional turmoil as they try to balance their friendship with their duties.
Perhaps a fanfiction where a powerful artifact is discovered that has the potential to change the balance of power on Cybertron. Megatron wants it for his own gain, and Optimus Prime wants to protect it. But when they both touch it simultaneously, they are transported to an alternate dimension where they must work together to find a way back, all while learning more about each other than they ever thought possible.
There could be a fanfiction where a strange energy source affects Optimus Prime and Megatron, causing them to swap personalities or abilities. This would be a humorous yet also thought - provoking plot. They would have to navigate their new selves while still trying to lead their factions. The Autobots would be confused by an aggressive Optimus and the Decepticons would be equally bewildered by a more pacifist Megatron.
Fanfiction about them can explore different universes and scenarios. For example, what if they were raised together? How would their relationship be different? It gives fans a chance to play with the established lore and create new and exciting stories that the official Transformers storylines may not explore. It also allows for deeper exploration of their motives and personalities.
Perhaps there's a story where Optimus and Megatron are both stranded on a desolate planet. Without their armies and with limited resources, they have to rely on each other to survive. As they struggle to find a way off the planet, they start to understand each other better. Megatron realizes that Optimus isn't just a naive idealist and Optimus sees that Megatron has reasons for his actions that are more complex than just pure evil.
One plot idea could be that Megatron and Optimus Prime are forced to team up in an alternate dimension. They have to put aside their differences to face a common enemy that is threatening the very fabric of that dimension. Maybe it's an ancient evil that has the power to destroy all Cybertronians.
You can try looking on some fanfiction websites like Archive of Our Own (AO3). It has a large collection of Transformers fanfictions, and there might be some related to Optimus Prime and Megatron in the MPreg genre.
It can also be appealing from a creative writing perspective. Writers can play with the personalities of the characters in this new and strange scenario. For example, how would Optimus Prime react to Megatron being in such a state? And vice versa. It gives a whole new layer to their complex relationship.