Rhaegar was deep into prophecy, and Dany has this flashback in the House of the Dead;
The fifth room, finally, shows a man very much alike her brother Viserys, except that he is taller and has eyes of dark indigo rather than lilac. He is speaking to a woman who is nursing a newborn babe, telling her that the child's name should be Aegon and saying that "What better name for a king?". The woman asks him if he will make a song for the child, and he replies that he has a song and that "He is the prince that was promised, and his is the song of ice and fire.". He appears to look at Dany then, as if seeing her, and then he adds that "There must be one more," and "The dragon has three heads.".
The problem is that Elia almost died in childbirth twice, so she couldnt have more kids. But Rhaegar knew winter was coming. He was working with Azor Ahai prophecy and trying to find that person. So.. Jon was always meant to be the third head of the Dragon... but you know, Gregor gotta Gregor. So I guess Bran is the third head because even though he doesn't have the blood, he can hackzor the Dragons brain and Warg it.