Reddit
The most frustrating thing as a trans person is that Bill Nye had a golden opportunity to explain some of the real (and complex) science behind trans people's existence and he flubbed it so hard.
I personally think the sex/gender terminological discourse is stupid because some people mean 'gender roles' when they say 'gender' and some people mean 'sex'. Creating an artificial category of 'gender' separate from gender roles and biological sex is stupid IMO and does trans people more harm than good discourse wise.
I strongly believe (and the evidence is compelling but not conclusive) that trans people are basically another type of intersex people that biologically developed the brain of the wrong sex. This post (credit to /u/CailanJade) below explains a lot of the science, sources at bottom:
What causes people to be transgender? A science lesson. Got ten minutes? This is long.
Twelve years ago I sat in Dr. Dennis Van Gerven's class at the University of Colorado. It was a course that covered "physical anthropology" which used to mean bones, but now means all human bodily physical remnants, and especially the evolution of humans and DNA. Basically, what makes humans human. Besides the amazing teaching style of Dr. Van Gerven (the best teacher I've had in my life) the class was highly informative and useful in not just my anthropology major, but probably half of the things I learned in that class I have applied to my life in some way, shape, or form.
We spent an entire week on the cause and effects of transgender. It was eye opening. I later learned the same is being taught in college bio classes, medical schools, nursing schools; it's pretty settled science. As always with science, the details are being worked out still, the nuances and whys and wherefores, but this isn't at all controversial within the science and medical fields.
So, ready for the science lesson? (Bill Nye really flubbed this one the other night and could use some lessons from Dr. Van Gerven).
During the fifth week of pregnancy a fetus' body organizes physical sex characteristics, and during the eleventh week of pregnancy the brain organizes into male or female type.
So, what causes the body and brain to organize one way or another? Hormones.
During each of these weeks in an XY fetus there is supposed to be a testosterone wash, where a gene on the tip of the Y chromosome flushes the whole body with testosterone. The strength of this wash determines the degree to which the body or brain is masculinized.
In the 5th week, this testosterone wash creates a basic male-pattern framework for the body and turns the gonads into testicles. Therefore you get a range of degrees of masculine traits in men. In some cases the strength of the wash is genetic and you get whole families where everyone is a Greek god, or another family where they're all more effeminate physical types.
In rare cases an XY (male) fetus will get zero testosterone and be entirely, completely female in physical form, but sterile. Or the fetus is resistant to testosterone (lack of androgen receptors) and the wash fails. The medical drama House featured this in one episode.
In an XX (female) fetus, testosterone levels should be low to non-existent, the gonads become ovaries, but the mother produces some natural testosterone, and if hers is a little bit high, it can give the XX fetus physically masculine traits such as wide shoulders, narrow hips or heavy musculature outside of the normal appearance of the other members of the family (variation outside of normal genetics of the parents). Occasionally an XX fetus will produce testosterone for unknown reasons. It is known that if the mother has hormonal issues with testosterone it can affect the fetus in this way, but it's rare to track a pregnant woman's hormones. Women secrete low levels of testosterone in their ovaries and adrenal gland, but usually not enough to have a serious effect.
So far this is just and overview of how hormones affect the physical sexual dimorphism (physical difference between male and female, aside from sexual organs) and variation within each sex, in most animal species, including humans. This is also how we get more and less masculine men, more and less masculine women. It all depends on how much testosterone there was, both during that crucial time period in the fifth week of pregnancy, then later again during puberty.
So what does this have to do with transgender?
The testosterone wash is repeated in the 11th week of pregnancy when the brain is organizing into either a female pattern or a male pattern. Yes, men and women have distinctly different brains. Again, testosterone causes masculine patterns while the default, without testosterone, the brain forms into a female pattern. There are a number of places you can go online to find the physical differences between male and female brains, but it has to do with what parts of the brain are larger or more dominant, and the number and type of connections between different parts of the brain, and the density of brain tissue.
Assume the first testosterone wash/lack of wash went fine and the body matches the chromosomes, perhaps perfectly male or female according to the DNA programming, perhaps just a little bit altered from the intended form but still clearly what DNA intended. The second time around, it may not work as well.
Again, sometimes this testosterone wash in an XY fetus is either very weak or sporadic. So, you get a fully, mostly or partially feminized brain in a male body. Or some parts of the brain may be feminized, others masculinized, especially in a sporadic wash. So you get different degrees of transness - those who are have fully or almost fully feminized brains are the more extreme male to female types, while those with weak or sporadic testosterone washes may be non-binary of varying types, depending on which parts of the brain was forming as those strong, weak, or non-existent testosterone moments happened.
In an XX female fetuses, the same works in reverse. There should be low to no testosterone in the fetus' system during development. If for some reason sometimes there is testosterone present, the XX fetus brain becomes masculinized to varying degrees.
Therefore you end up with a female brain in a male body, a male brain in a female body, or a mixed brain in either body. The social expectations, desires and "parts" don't match up with what the brain expects, and you get "dysphoria," the panicked feeling the brain gets when body parts aren't adding up the way the brain thinks they should, and is getting hormones it isn't expecting (or missing hormones it wants).
The current estimate is that one in 187 individuals is trans of some kind, either male to female, female to male, or "non-binary," which is the umbrella term for the mixed brain gender types such as bi-gender and genderfluid, and those who are agender (totally missing a connection to gender) or androgyne (blended gender).
So, that's the bare basics of it, as science currently understands the causes of transgender. There may be some cutting edge stuff I'm not aware of, but this is what current science understands, mostly unchanged from my class 12 years ago.
Edit: some sources
https://www.ncbi.nlm.nih.gov/books/NBK222286/
https://www.ncbi.nlm.nih.gov/pubmed/19955753
https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3296090/
http://link.springer.com/referenceworkentry/10.1007/978-1-4614-1997-6_115
http://www.ncbi.nlm.nih.gov/pmc/articles/PMC3928415/