Here's the talk that Aemon gives.
Aemon: "No one ever looked for a girl," he said. "It was a prince that was promised, not a princess. Rhaegar, I thought...the smoke was from the fire that devoured Summerhall on the day of his birth, the salt from the tears shed for those who died. He shared my belief when he was young, but later he became persuaded that it was his own son fulfilled the prophecy, for a comet had been seen above King's Landing on the night Aegon was concieved, and Rhaegar was certain the bleeding star had to be a comet. What fools we were, who thought ourselves so wise! The error crept in from the translation. Dragons are neither male nor female, Barth saw the truth of that, but now one and now the other, as changeable as flame. The language misled us all for a thousand years. Daenerys is the one, born amidst salt and smoke. The dragons prove it."
As for the gender changing thing, it seems to me that this quote doesnt mean that dragons could physically change gender, but this is more of a role changing. As it applies to Dany, I think that it is just to show that she doesn't need to be male to fulfill the prophesy.