Gender is a neuro-social concept while sex is anatomical. Different genders have their brains wired differently, and as the brain develops in a different stage of the body to the rest of the embryo, hormonal fluctuations diring pregnancy can create a physical, clearly defined, mismatch. Please, do a bit of research from time to time, it can come in handy.