So Gandalf, huh? Quite the guy. The guy who, when you think about it, is playing chess with Sauron for the whole of the The Lord of the Rings Franchise. Now, full disclaimer, I have read all of Tolkeins other works on Middle-Earth and beyond, so I know his real name is Olórin and that he hails from Valinor as he is, in fact, one of the Maiar. But this is the movies we're talking, and in the movies he can have a different story, one that's more fun to theorize about. Because we actually learn precious little about him there.
So what am I proposing? It's at once simple and mind-bogglingly complex. Gandalf (within the movies) doesn't really have a story, he's just a wizard that's a good guy, and he tends to come and go as he pleases in the Hobbit, frequently vanishing to do other important things elsewhere. But what if, some of the times he leaves, and during his life before the Hobbit films, he's not just traversing Middle-Earth. What if...
Gandalf can cross dimensions
Ok, even though I wrote that, it sounds a little crazy, but I'm gonna keep talking and hopefully it'll make more sense the more you read. See, the way that Gandalf's spirit travels dimensions is by dying, and then being reborn after a brief time as a free-roaming spirit, before taking a new body in another dimension. You'll see what I'm getting at in a minute.
I mean, the wise old man trope is one that's in so many movies that y'know what? It's just cooler to imagine that Gandalf is all of them under a different name, rather than just an overused cliche. So let's go through Gandalf's origin...
World 1 - Dumbledore
So, originally, he's born in Godric's hollow, suffers tragedy in his life through the loss of his father, mother and sister. Then he spends a lifetime campaigning against the dark arts after his betrayal by his best friend Grindelwald. Then Voldemort, and we all know the story. Sure, he dies, but magic. He's not just a wizard, but a magical spirit created by the Valar who happens to originate from this world. So it is here that he learns to become a wise mentor for the heroes of the universe he inhabits, and to be a beacon of hope for all those who resist evil. Then he dies, prompting him to traverse to another universe...
World 2 - Obi-Wan Kenobi
After dying at the hands of Severus Snape, but coming back in another form to aid Harry defeating Voldemort, Dumbledore's spirit travels to a galaxy far, far away, giving himself a new body as a Jedi. It is here that he grows to become another wise hermit who helps Luke Skywalker to defeat yet another evil empire builder. Here he grows further into the Gandalf we all know and love by becoming a jedi in an attempt to try and learn more about his powers through this dimension's "force". He also experiences another betrayal by Anakin, vaguely similar to the one he experienced at the hands of Grindelwald. Then he is murdered by Darth Vader, but again manages to permeate this world for just long enough to ensure that good triumphs.
World 3 - The Ancient One
The Ancient One is the mentor to Doctor Strange, who has a movie upcoming, so I'm counting his comic story as another dimension here. Basically, when he was young, he and his friend Kaluu discover the power of magic, but guess what? Kaluu ends up turning evil and it falls to the Ancient one to stop him. Sense a pattern here? In this particular realm, he learns to guide events as a figure of power and develops more into a fount of wisdom rather than simply the teacher and father figure that Luke Skywalker and Harry Potter knew. 500 odd years later, he acts as a mentor to Dr. Stephen Strange, helping him mature from an egotistical doctor, to a responsible and heroic sorcerer supreme. However, his physical form is destroyed in an attempt to thwart Shuma-Gorath, a villain to Dr. Strange. However, his spirit again lives on in order to help Strange defeat the antagonist "Eternity".
World 4 - Gandalf
Finally, his spirit finds its way to Middle-Earth, where he finds his full power with the help of the Valar, who send him and four other similar spirits to stop evil in the Eastern realms,. However, as you know, Saruman betrays Gandalf, leaving him as the only one to stop Sauron. Naturally, he (sort of) dies at the hands of the Balrog, but now, with his newfound knowledge of his power thanks to the Valar, he manages to come back in a physical form to the same realm as he has found a home in Middle-Earth, as the Valar help him by breaking the painful spell of his reincarnation and eternal betrayal. So he returns as Gandalf the White to end Sauron's schemes, living happily ever after with Frodo, Bilbo and many other in the Undying Lands.
So, did I convince you? Or do you think I'm completely off my nut? I think it's a pretty awesome theory, but then again, I'm kinda biased in that regard, so feel free to put me straight, I just thought some of the similarites were pretty spooky, so hey, I had some fun with it, and I hope you did too.