Norse Mythology in Tolkien’s Work: Gandalf
Gandalf is very nearly a cut-and-paste remix of Odin Borson the Allfather.
He is an old man in a grey traveling cloak with a wide-brimmed hat and a walking stick who travels the world helping people and imparting knowledge, and is known to give advice to heroes and convince them to go on quests/adventures.
”... a certain man came into the hall unknown of aspect to all men; and suchlike array he had, that over him was a spotted cloak, and he was bare-foot, and had linen-breeches knit tight even unto the bone, and he had a sword in his hand as he went up to the Branstock, and a slouched hat upon his head: huge he was, and seeming-ancient, and one-eyed” -- From the Saga of the Völsungs, Chapter 3: Of the Sword that Sigmund, Volsung's son, drew from the Branstock
^ Georg Von Rosen's 1886 depiction of Odin vs Gandalf in The Lord of the Rings and The Hobbit
He is often seen on battlefields and his horse is the fastest horse in existence (Shadowfax for Gandalf, Sleipnir for Odin).
He is not immune to the pull of a magic golden ring (The Otter’s Ransom). He sacrifices himself and in turn is given knowledge/power (in Odin’s case he was hung from a tree for nine days and nine nights while impaled with a spear before the Runes decided to reveal themselves to him, as told in the Hávamál section of the Poetic Edda).
Gandalf's name is taken directly from the Dvergatal section of the Norse poem Vǫluspá (Stanzas 9-16), which consists of a list of dwarven lineages.