Paladin is a better match.
Sure, but easier said than done. One would need to compare which specific 5e feature with what the Tolkien narrative describes, considering both the flavor and the action. Some D&D features feel closer than others.
Presumably his race can do some magical effect, but then which official race? Which race trait? Which event in the Tolkien story.
As is, the Paladin class explains most or all of the texts about Gandalf.
Some posters prefer Gandalf be an NPC with a monster statblock. Of course, if a DM is introducing Gandalf or a Gandalf-esque into an adventure, then the NPC is the way to do it.
But, Gandalf is a compelling character concept that is an interesting choice for a player character. I feel it is worthwhile to explore the most exact official
mechanics possible to build a Gandalf player character. Then a player can use this information to build ones own character and modify it according to taste.
It seems to me, the staff of Gandalf is his Paladin holy symbol.
He needs his holy symbol.
But his holy symbol might also be a magic item with magical benefits, such as to enhance his spellcasting or add spells of its own, or likely grant him an AC bonus.
The lack of a spellbook, the lack of academic flavor, the emphatic Charisma, the centrality of alignment, makes a D&D Wizard feel inappropriate. I find a divine Sorcerer a better match than a Wizard. And a Paladin best of all.
Meanwhile, his divine spells are significantly high level, like Healing and Restoration, and he appears to Turn Undead that are high level. By contrast, those spells resembling wizardry like blowing smoke rings are at the low level of a cantrip or minor spells, and are easier to explain as a peripheral magic item, a feat granting cantrip and spell, or a brief multiclass dip. The Paladin features feel central.
Gandalf is highly effective in melee combat.
If Gandalf chose to wear heavy armor, few would doubt he is a Paladin. But he seems to dislike armor that would impede his high Dexterity. No doubt he boosts his AC magically, as a Paladin can, and maybe his magic holy symbol can too.
As above. Nothing in D&D forces a high Dex Paladin to wear armor. He seems to prefer Dex plus Paladin buffs and possibly magic item buffs instead.
The 5e Paladin (also Bard) is a remarkably versatile class that can support many character concepts.
Regarding Gandalf, he is a normal Devotion Paladin. Heh, to get distracted by his lack of armor is ... superficial.