One possible fanfiction could be about Optimus Prime and Megatron having to team up against a greater threat. Maybe an ancient evil from Cybertron's past resurfaces that is so powerful that their usual enmity has to be put aside. They start off distrusting each other but as they face battles together, they gradually come to respect the other's fighting skills.
If they switched sides in fanfiction, it would be a huge shock. Optimus as a 'bad guy' would be very different. He might use his leadership skills in a more tyrannical way. Megatron as a 'good guy' would be strange too. He'd have to fight his own nature of seeking power. But it could make for an interesting story as they both struggle with their new identities.
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.
A fanfiction could also explore a post - apocalyptic Cybertron where Megatron and Optimus Prime are the last two Transformers alive. They have to put aside their differences to try and rebuild their world. This would be a very emotional and character - driven story. They would have to confront their past actions and the reasons for their long - standing feud. As they work together, they might discover that they are not so different after all, and that their shared love for Cybertron could be the key to its restoration.
In a fanfiction, it could be interesting to see a scenario where Megatron and Optimus Prime are reborn in a different time and place, perhaps in a peaceful Cybertron that has long forgotten the war. They might struggle to adapt to this new world where their old identities as war leaders are no longer relevant. Their journey could involve rediscovering themselves and learning to live in harmony, which would be a huge departure from their traditional roles.
One possible fanfiction could be that they are brothers separated at birth. Megatron is raised in a harsher part of Cybertron, which shapes his more aggressive views, while Optimus Prime is raised in a more diplomatic environment. Their reunion could be a turning point for the entire Cybertronian civilization.
In a fanfiction where they unite, it could start with a common threat that neither side can face alone. For example, an alien race invades Cybertron. Megatron and Optimus Prime realize that their brotherly bond is stronger than their differences. Together, they could form a new strategy, using both Autobot and Decepticon forces in a coordinated way to repel the invaders.
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.
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.