Different disciplines can argue they have their own narrow definition of sex (like maybe genetics), but if we're going to talk in a broader, general medical or biological context, we need a more nuanced definition to account for intersex conditions.
If we're discussing biology or medicine, we're going to be concerned with whole body sex in practical scenarios. This is going to be what's important to your average person off the street, your average biologist performing a study, and your average doctor.
Again, in narrow contexts like genetics, they might have a more strict definition.
This means we're really concerned with the SRY gene and its effects, not literally just XX or XY chromosomes or organs alone.
The SRY gene (and in a few outlier cases, other genes can contribute) is what triggers virilization. It sets off differentiating the gonads into either female gonads (ovaries) or male gonads (testicles). Male gonads start androgen production. The rest of the body responds to androgens with virilization.
XX people with gonadal dysgenesis do not have functional ovaries. They have female anatomy but it won't develop beyond childhood without hormone treatments. However with hormone treatments, they develop normally and if they have a uterus, they can become pregnant with an implanted ovum. It would be completely legitimate to refer to these people as biologically female. They do not simply "look like" they're female, but actually are female (by a fairly mainstream biological definition of female).
XY people with no SRY gene have similar issues. They can have most of what makes up normal female sex organs (aside from ovaries, instead they usually have streak gonads) and can possibly become pregnant. Again, it is entirely reasonable to consider them biologically female, just with a medical disorder.
And finally, people with CAIS have a functional SRY gene, however their bodies do not respond to testosterone. They do not (and cannot) virilize. The essential function of androgens in development is to keep the female parts from developing and instead have them develop into male parts.
If the androgens cannot do their job, female parts instead develop. The rest of the body also develops as females would.
And even the internal testicles do not develop the way they do in males. Even if we artificially gave CAIS individuals testosterone, their testicles couldn't function because they are entirely insensitive to androgens. Their bodies convert testosterone into estrogen.
That's the ironic thing; even if some CAIS woman tried to troon out and become a transman, artificial testosterone injections would just make them look more female.
Intersex really isn't biologically accurate. It's a (somewhat archaic) political term.
Honestly? That's kind of how biology in this area often works.
Not always, mind you. So for example, people with Kleinfelter syndrome are definitely male.
But a lot of different genetic disorders cause the body to develop as a female by default, because of how early stage sex differentiation works.
Factually speaking, without a functional SRY gene, they would be female, not male. At least by a mainstream biological standard. You can get into the weeds about other niche definitions, but that's not really relevant to 99% of biological or medical science.