Gandalf is a Maia in J.R.R. Tolkien’s legendarium.
Before arriving in Middle-earth, Gandalf was known as Olórin and belonged to the Maiar, spiritual beings who served the Valar. The Maiar and Valar are both part of the Ainur, beings created by Eru Ilúvatar before the shaping of the world.
Gandalf came to Middle-earth in the Third Age as one of the Istari, or Wizards. In that role he appeared as an old man and was sent to oppose Sauron while guiding the peoples of Middle-earth rather than ruling them directly.
Readers sometimes classify Gandalf as a wizard, which describes his role and outward form, or confuse him with a Vala, a more powerful order of Ainur. His transformation after confronting the Balrog does not change his underlying identity as a Maia.