Considering most people's gender identity matches what is assigned at birth that is hardly a surprise.
The human mind can e a difficult thing to understand. As far as we can tell it is a product of the brain. That includes how one views oneself. Think about it like this take you, your personality how you view yourself take all of that exactly as you are right now, and then imagine that instead of your current body you had a body that was the opposite sex. If you are male the current you instead has the body of a female. That is what many trans people are going through.