Mayhem was born and raised on the Draconequus homeland of Equestria. He was the first one chosen to be the next in line for his parents' throne. But Mayhem soon went overboard when, on the day Celestia was born, he discovered that Draconequui were originally meant for evil and chaos, and that the former ruler, Tyranny, had waged the bloody Chaos War with Celestia's ancestors long ago until his race was reformed by Mayhem's ancestors, who decided that chaos was far too dangerous and risky for them to be agreeing with, and that they should spread happiness and laughter instead. When Tyranny had enough, he tried to single-handedly wipe out all of the Equestrian gods and take over Equestria by force. But Celestia's ancestors banished him into the ice of the Frozen North, but at the cost of their lives. Mayhem soon grew jealous, and on the day his younger brother, Discord, was born, he began spreading chaos 50 miles from the Draconequus Magic Border Line, which prohibited Draconequus magic from crossing into pony territory. This resulted in his banishment, and his position was passed down to Discord.
While Discord was growing up, he began forming a small bond with Celestia and Luna, who had been born 5 years after Celestia's birth and Mayhem's banishment. The only downside was Discord didn't seem to understand the two sisters, and thought of them as dull and boring as time passed by. He was a little funny and always liked to pull pranks on the sisters to amuse himself. Then, when Discord became 18, and was about to be made a prince, Mayhem captured him, and took him to his hideout. There, he tempted him to become a spirit of chaos by telling him about the Chaos War, and then tells him lies about how ponies of Equestria, especially Celestia and Luna, would prosecute his kind for being part of the Chaos War, and would eventually lead to discrimination. Soon enough, both brothers began wreaking chaos throughout Equestria, took over Canterlot, and caused misery for the 3 pony tribes.
While Discord ruled Equestria, Mayhem was the vice-king and commander of Discord's spiritual, monstrous, and elemental guards. Mayhem turned Celestia's family into snake-tailed, dragon-winged pony monsters called Serpicorns, and captured them into slavery, which Discord didn't really seem to care about. Discord just wanted to continue pulling pranks of the sisters. But luckily, they escaped with their parents, and had discovered what Discord and Mayhem were doing to the three pony tribes, and decided to do something. Celestia and Luna's parents, Nightus and Heavenslight, seek help from Starswirl the Bearded, who was creating a solution to the chaos around them. He was creating 11 relics that would maintain harmony for Equestria. He artificially created 5 of them (Guidance, Sincereity, Courage, Compassion, and Faith), and would allow the 6 others (Magic, Kindness, Laughter, Honesty, Loyalty, and Generosity) to be bred by a magical tree called the Tree of Harmony. Celestia and Luna didn't quite understand the ponies' religions since the Equestrian gods didn't give concern about mortals for millions of years. Unfortunately, Mayhem discovers this, and declares chaos in Equestria to be doubled as punishment for treason. Celestia and Luna finally understood the power of harmony, and were transformed back into Alicorns along with their parents.
Mayhem retreats, and tells Discord everything. Discord then decided that the sisters should be stopped once and for all, and plans to capture the Tree's magic and use it to capture the sisters. Mayhem gives Discord special chaotic seeds called 'plunder seeds' which would allow him to achieve this victory. But he didn't realize that Celestia and Luna have both found the Tree first after Starswirl ordered them to find it and use it's Elements to defeat Discord and Mayhem, and restore harmony in Equestria. So they found the Elements, and fought their way past Mayhem's elemental guards and forces, reach Discord, and turn him to stone. Mayhem came in and saw what happened to his brother. The Celestial sisters went after Mayhem, but he was twice as powerful as Discord. Mayhem counteracted the Elements, and fled Equestria without a trace after swearing revenge on the Celestial family. With harmony back in Equestria, the sisters' parents put up a protective invisible magical barrier to keep Mayhem from exacting his revenge, or stealing any of the 11 Elements of Harmony. All the Serpicorns were turned into unchaotic sentient creatures and kept in peace.
With the invisible barrier, Mayhem was unable to free Discord, and couldn't even enter Canterlot's perimeter. But things changed when Taiklar Blackheart killed Nightus and Heavenslight, absorbing their souls, and took the artificial 5 Elements of Harmony. With only the 6 New Elements left in magic-proof security, Celestia and Luna took control of Equestria, and kept it safe and running. But thousands of years later, Discord was freed in the 2nd Season of the G4 series. Discord's chaos caused the protective magical barrier to dissipate, which allowed Mayhem to come back. However, upon witnessing Discord's second defeat, Mayhem learned that Celestia and Luna had forgotten about their parents' disabled shield. Knowing that there was nothing to hold him back, Mayhem spent the rest of his time spying on the Mane 6, Celestia and Luna, and even the Shell Lodge after they first crashed into Equestria. After doing this for a couple of years, Mayhem had learned all the strengths and weaknesses of his soon-to-be adversaries and when the time was right, he would strike and free Discord. However, the plan was jeopardized after Mayhem learned that Discord was reformed, and Mayhem decided to change plans. He would wait a while longer before he would make a return.
Role Outside of the Spongebob Series
Mayhem appears in Tman's fanmake parody of The Jungle Book/Lion King/Tarzan as Kaa, tempting Kairi who is the Mowgli/Simba/Tarzan leading lady of the fanmade story to trust in him while doing the evil bidding of Malefor who is the Shere Khan/Scar Big Bad of the fic.