It's not a sex thing, it's a gender thing. Gender and sex are different from each other. You can't change your sex, but you can change you gender, which is why it's called Trans Gender, and not Trans sex. You could get surgery but that surgery is called Gender Reassignment surgery and not Sex Reassignment, because you're not changing your sex, you're changing your Gender.
Now to the difference between Gender and Sex. For example, I identify as Nonbinary, while my sex is Female. I can't change my sex, but I can change my gender. They're linked but not the same. Madison Bentley defined gender as the "socialized observed of sex." Gender is how you present yourself.
Now you probably have heard the whole "gender dysphoria" rant many times, so I'm going to keep this short. The whole gender being what you present as mixes in with this. Gender Dysphoria is a mental issue many Trans people deal with, and it's when you feel distress because you're not presenting yourself as the gender you feel that you are. This is what causes people to go from male to female, female to male, female to nonbinary, ect.
I tried to keep this all together but I tend to rant alot. There as been scientific research on this stuff, and you could research it on your own. I'm not hear to teach you, just to share my opinion : ).