You confused sex with gender. Science shows that being trans is genetic. Some experts believe it is caused by hormones in the womb, genes, and also cultural and environmental factors 

Many species of frogs and other amphibians can change their sex. It’s biological.