First, I want to make sure that we're all on the same page about whether we're talking about sex or gender here.
Nowadays, we generally make the following distinctions:
- Sex generally refers to your biological sex; in other words, your anatomical and genetic traits.
- Gender is more difficult to define, but it generally refers to the socially constructed characteristics of males and females as they apply to you, such as norms, roles, and relationships of and between groups of women and men.
It should be noted that in informal speak, people frequently use the terms interchangeably.
Luka's gender is more ambiguous and subject to debate (just look at the comments on Luka's wikia page), but in this case, we just want to talk about Luka's biological sex, which is more clear-cut. Let's review what happened:
- Luka was physically male before the D-mail.
- Luka sent a D-mail back to his pregnant mom's pager.
- And as Okabe discovers later on, this caused Luka to become physically female.
However, a baby's sex is determined at the moment of conception. So, because Luka's mom was already pregnant when the D-mail arrived, Luka's sex was already decided. No amount of eating vegetables can change that.
One explanation could be that the cause was some other time travel divergence, at a point in time before Luka's conception. Even if the divergence were completely unrelated to Luka's family, it could still cause random variations in the environment that could cause Luka's conception to go very slightly differently.
However, Faris's D-Mail was sent to a point in time after Luka was already born, so I don't think this explanation is very likely.
Another possible explanation could be that the D-mail caused a random variation in the environment that caused Luka to develop differently in the womb. For example, it could be that in the new timeline, there was a random genetic mutation that caused Luka to develop an intersex condition. They're not that uncommon.
It is indeed possible for someone with XY chromosomes to be physically female.
For example, perhaps Luka experienced a mutation in the SRY gene:
Mutations in SRY give rise to XY females with gonadal dysgenesis who appear to be normal females at birth, but at puberty do not develop secondary sexual characteristics, do not menstruate, and have fibrous gonads without eggs.
Or, perhaps Luka experienced a mutation in the AR gene and developed complete androgen insensitivity syndrome:
Androgen insensitivity syndrome (AIS) is when a person who is genetically male (who has one X and one Y chromosome) is resistant to male hormones (called androgens). As a result, the person has some or all of the physical traits of a woman, but the genetic makeup of a man.
At puberty, female sex characteristics (such as breasts) develop. However, the person does not menstruate and become fertile.
The complete form of this syndrome can occur in as many as 1 in 20,000 live births, so I think it's certainly a possibility.
Anyway, these are just my speculations.