Intro. Maegor the Cruel wanted a son to ensure his own succession to the Iron Throne and delegitimize the claim of his half-brother, Aenys I, and his sons. A male heir of pure Targaryen blood would irrefutably guarantee his dynasty.
Maegor's motivations:
Contesting Aenys' succession: Maegor usurped the throne from his half-brother, Aenys I, and had no legitimate claim that was accepted by all. His nephews, the sons of Aenys, represented a direct threat, with a lineage more accepted by the kingdom. A son of his would be a more powerful legitimate heir than any of Aenys's children, weakening his claims.
Strengthen his power: His tyranny and unpopularity as king meant that he constantly needed to reassert his rule. Having an heir who could continue his pure-blood lineage was a way of consolidating his power.
Uncertainty