Why did Lord Hanuman forget that he has special powers?
I found an actual scriptural account of the story the other two answers describe, from the Uttara Kanda of the Ramayana.
Because of the boons he received and the strength which he gained from them, Hanuman was replete with his own speed, like the ocean. Overflowing with energy, Hanuman fearlessly desecrated the hermitages of great sages. He broke the sacrificial laddles and vessels, interrupted the offering of oblations into sacrificial fires and tore up the piles of bark cloth belonging to the peaceful sages. The mighty Hanuman continued doing such deeds. Knowing that Brahma had made him invulnerable to punishment by brahmanas, the sages tolerated it because of his power.
Although prohibited by [his fathers] Kesari and Vayu, Hanuman went beyond the bounds of propriety. Great sages born in the families of Bhrigu and Angira, who were never overly angry or wrathful, became furious and cursed him in the following way: "O monkey, illusioned by our curse, you will for a long time be unaware of your own strength, by dint of which you harassed us. Your strenth will again grow when you are reminded of your glory." Thereafter, by the power of the words of the great sages, Hanuman was deprived of his strength.
That curse is what caused him to forget his powers.
You also asked whether Hanuman has the power to genuinely fly. I think the answer is yes, because Jambavan tells him that he has the same powers of flight as his father Vayu the wind god:
You are the lineal son of Air-god, and even by your gusting you are selfsame to Air-god, and even by your flying also you are his selfsame to Air-god, in all respects[.}
Note: “The question: Why did Lord Hanuman forget that he has special powers?” is licensed by Stack Exchange Inc (https://hinduism.stackexchange.com/); user contributions licensed under CC BY-SA.