According to the teaching of the Ari z"l as written by Rabbi Chaim Vital, it will be like it was with Moshe Rabbeinu. Moshe was born of flesh and blood by a mother and father just like everyone else. So it will be with Moshiach. At the beginning of his life he doesn't even know himself who he is. Through leading a righteous life he will gain greater and greater merit until, like Moshe, he will merit to the perfection of his nefesh, ruach and neshamah.
For Moshe this was completing the tikkun of Hevel (הבל) and Sheth (שת). This was indicated in the written Torah by the burning bush (הלבת אש מתוך הסנה). The burning fire is the letters from the names of Hevel and Sheth. At this point, like Moshe, he will know that he is the actual Redeemer. But most of the Jewish people will not know or recognize this.
Rabbi Vital goes to explain that, like Moshe, after telling the Jewish people that the time of the redemption has come Moshiach will go into hiding, both body and soul. It equates this time period with when Moshe entered the cloud to receive the Torah. It says Moshiach will actually depart this world physically. And when he returns only then will he be revealed completely and all Israel will discern and recognize him.
This is recorded in Sefer Ohr HaChamah, Volume 2, 8b on the Zohar, Shemot 7b. Sefer Ohr HaChamah is the second book of the master commentary on the Zohar called Sefer Kiryat Arba. It was compiled by Rabbi Avraham Azulai, the author of Chesed l'Avraham and the grandfather of the Chida, Rabbi Chaim Yosef David Azulai.