In the Undying Lands, Gandalf was a Maia spirit called Olórin. He lived in the Gardens of Lorien and would often visit Nienna the Compassionate. In circa TA 1000 (Third Age), he was chosen as one of the Istari wizards who were sent to Middle-earth. During this time, he was known by many names: 'Gandalf the Grey' (In Westron), 'Mithrandir' (by the Elves), 'Tharkûn' (by the Dwarves), and 'Incanus' (by the Haradrim). He was given the form of a bearded old man in a grey cloak, pointed hat and staff. When he arrived in the Grey Havens, he was given Narya (the ring of fire) by Círdan.
For over 2000 years, Gandalf the Grey worked against the rising evil powers in Middle-earth. In TA 2941, Gandalf led a quest to the Lonely Mountain where Smaug the Dragon was slain. During the quest, Gandalf acquired the sword Glamdring and Bilbo Baggins found the One Ring. In TA 3018, Gandalf came to Frodo Baggins and initiated the Quest of the Ring. In Rivendell, he became a member of the Fellowship of the Ring and led his companions through many different perils and adventures. However, in the Mines of Moria, upon the Bridge of Khazad-dûm, Gandalf faced a Balrog. He claimed to be "A servant of the Secret Fire...wielder of the Flame of Anor." No one knows what he meant by the Flame of Anor. The wizard was pulled from the bridge when he toppled the Balrog from it and appeared (to the Fellowship) to have been slain. This was not the case, and Gandalf slew the Balrog but lost his strength and died.