In a passage from 'Unfinished Tales' by Tolkien the origin of the wizards is described. They were sent to middle-earth by the Valar (angelic servants of Eru the creator):
"For with the consent of Eru they sent members of their own high order, but clad in bodies as of Men, real and not feigned, but subject to the fears and pains and weariness of earth, able to hunger and thirst and be slain; though because of their noble spirits they did not die, and aged only by the cares and labours of many long years." Unfinished Tales, p. 503
In other words, Gandalf is the incarnation of an (almost) divine being.