Sex characteristics are expressed primarily via hormones. That is why, for example, a person with an XY chromosome karyotype and complete androgen insensitivity syndrome will appear fully "female" externally.
Hormones are affected by DNA and genes, but can be overridden to alter secondary sex characteristics. Ideally (in most cases), this would be done pre-puberty, but even later in life it is possible to induce a "second puberty" which results in major changes. Further changes, including to primary sex characteristics, can be achieved surgically.
These changes do not need to follow a standard "male" or "female" template. Characteristics can be mixed, matched and/or rejected. Current medical technology has limits, but they are beyond what you might expect.
> I thought trans was about changing gender, not changing sex.
This is a matter of perspective and how one defines things.
An alternative view is that it is about affecting external change to match what the internal state was all along.
More poetically, one could describe it as "the realization that one needn't continue wearing the disguise that society seemed to demand".
Or, if one wants to be shitposty about coming out after having established a career, "New Game+".
A good example of an opposing point of view to 'sex realism' is this article (and one that's most often cited in online discussions of this particular topic): https://blogs.scientificamerican.com/voices/stop-using-phony...
Mostly true, but it's confusing. Historically, sex and gender have been used interchangeably. That is slowly changing. There are a lot of places that refer to "sex" where "biological sex", as you put it, is not what is meant. See e.g. how trans people can still get their "sex" updated on documents that refer to sex and not gender, and how many places described as single-sex are actually closer to single-gender.
This really isn't true. "Sex" was the only word anyone used for most of history; the idea that there's a distinction between "sex" and "gender" was invented by the sexologist John Money in 1955.
https://en.wikipedia.org/wiki/Gender#History_of_the_concept
"Gender" was originally a term from linguistics that had nothing to do with biological sex.