Dimitri is the second son of a maritime kingdom. For months, his mother has been trying to marry him off to rich or royal families to solidify their own family's standing. While hiding out in Vexia, he meets Tameer, the queen's adopted brother, who proposes a solution to both of their problems: fake an engagement!
If Irena has a son, she'll be able to rule, unopposed, as Queen Mother until the young prince comes of age. They can call off the engagement as soon as the baby is born, so long as the child is male. Dimitri can return home, brokenhearted, and his mother will leave him alone. At least for a little while.
If Irena has a daughter? Well, as Tameer says, "We'll burn that bridge if we come to it."