Here's how The Punisher got an upgrade and became the Cosmic Ghost Rider. The Punisher is one of Marvel's most unique "superheroes" in that he just tends to shoot villains in the head and call it a day. Frank Castle - AKA The Punisher - was first introduced as a villain in a Spider-Man comic before earning his own series. The character has had multiple live-action versions, having been played by Dolph Lundgren, Tom Jane and Ray Stevenson in different movies. Jon Bernthal was the latest to take on the iconic skull, first appearing in Netflix's Daredevil season 2 before earning a solo show, which ran for two seasons before it was cancelled.
The Ghost Rider first appeared in comics in 1972, and many characters have taken on the name, including Johnny Blaze and Robbie Reyes. The Ghost Rider is possessed by the Spirit Of Vengence, which causes the rider's skull to burst into flame and gives them supernatural power. The character has also had an eventual live-action journey, with Nicolas Cage playing Johnny Blaze in two ill-received movies. The Ghost Rider then appeared as a recurring character on Agents On S.H.I.E.L.D. during season 4 with Gabriel Luna playing Reyes. Luna was set to return for a solo Ghost Rider Hulu series which was later cancelled in late 2019.
Ghost Rider has fused with some interesting characters in the comics, including the time he joined with Red Hulk and Venom. There's unlikely to be a more perfect pairing than the Spirit of Vengeance and The Punisher, however, which is how the Cosmic Ghost Rider came to be. In an alternate version of Earth, The Punisher was going about his vigilante duties when Thanos arrived and slaughtered the planet, with Frank Castle later sent to Hell. There's where he makes a literal deal with the Devil to return in the form of the Ghost Rider, but when he comes back to Earth, Thanos is long gone and Frank is left on a dead planet.
Thankfully, Galactus arrives and Frank makes a deal, becoming his herald for a shot at revenge against Thanos. This is how he becomes the Cosmic Ghost Rider, and he and Galactus become buddies as they travel the galaxy their quest. This ends badly, with both Cosmic Ghost Rider and Galactus being killed. Frank still can't get any rest in death, with Odin bringing him to Valhalla. When it's clear he'll never fit in there, Odin restores his Ghost Rider powers and sent him back to a time when Thanos was just a baby.
Cosmic Ghost Rider prepares to kill baby Thanos, only to realize he could still change his fate. He brings baby Thanos with him in an attempt to show him another way and creates a new timeline where the Mad Titan becomes something ever worse - Thanos the Punisher. He shows his "father" the world he created under The Punisher's influence, where he saved Frank's family but became a savage dictator, leading to a battle between them. The journey of the Cosmic Ghost Rider is still ongoing, and will likely only get crazier.