What would be factually accurate would be to say that Semenya is a male with a disorder of sexual development that resulted in ambiguous or misleading genitals being recorded at birth.
So you think it's more accurate to say she's a male with a DSD that resulted in female appearance at birth, which led to female legal status and female upbringing. Whether that is why she has a female self identity is unknown/unknowable. Either way, it's her intersex traits at the heart of her legal case.
Is Semenya's XY chromosome pairing the definitive trait that makes her a male? Heather Heyer has the XY genotype and you said she's female since she was able to give birth.

You appear to have answered your own question.
I have my own opinion but Emily Lake rejects "intersex" as a valid category. She has stated her opinion that Heather Heyer is female and Castor Semenya is male despite both of them having the XY karyotype, apparently because Heyer grew a uterus while Semenya's vagina doesn't lead to one (that we know of).
She has not said whether she considers the person referenced earlier in this thread who had a penis, testis, and fully formed uterus with attached fallopian tube to be male, although I presume she does considering his proven ability to father children.
Perhaps you could consider reading a bit more, and assuming a bit less? I'm getting tired of having to repeat myself over and over, since the true believers like to swap out piles of straw.
Sex in humans (and mammals and birds and every anisogamous species on the planet) is defined by the type of reproductive system that an individual has. In every anisogamous species, there is one reproductive system that evolved to support the production of large gametes, and a different reproductive system that evolved to support the production of small gametes.
Actual production of gametes is not required. What matters is the type of
reproductive system the individual has.
Some very few people have disorders of sexual development that result in their reproductive systems not developing as expected for normal humans. The majority of people with DSDs are phenotypically normal - they have an entire male reproductive system, or an entire female reproductive system, with no aberrations or anomalies. Those people, the majority, have DSDs that express with complications either at puberty or when they try to have kids and find that they're sterile or that their fertility is negatively affected. A small minority of people with DSDs have conditions that can occur with ambiguous external genitals. The most common of those is 5-ARD, which can result in "girl-ish" looking genitals at birth - in third world countries where nobody bothers to look closer, these individuals are sometimes recorded as second-class citizens because they're not "male enough" to be counted among the real men. At puberty, however, those males with 5-ARD will experience a normal male puberty and their bodies will change along male development patterns.
The term "intersex" is a misnomer - and it's a term that is fairly heavily objected to by people who actually have DSDs. People who actually have DSDs object, because it gives the entirely false perception that they're somehow a different sex than male or female, and they aren't. Their treatment modalities are completely dependent upon them being male or female, and the disorders themselves diverge by sex. Almost every single DSD out there is explicitly a male disorder or a female disorder. Ovotesticular disorder is one of the only ones that can occur in either sex, and can be challenging for doctors to figure out shich sex the individual is - it frequently occurs as a result of mosaicism.
At the end of the day, the people who most ardently hang on to the term "intersex" are activists and advocates on behalf of people with transgender identities. The overwhelming majority of people with transgender identities do NOT have DSDs of any sort, and certainly don't have ambiguous genitals. Rather, they latch on the term because they can abuse someone else's medical condition in order to further their ideology by pretending that sex in humans is a spectrum.
Yes, I reject "intersex" as a valid sex category, because it isn't a valid sex category.