You misunderstand the difference between sex and gender. Sex is your genitalia. Gender is what you identify as and is whatever you want it to be. Male and female are terms used to describe sex, not gender. That being said, nowadays, people use male and female as terms for gender as well, so it's really not THAT big of a deal. It's just the easiest way of asking what you have as genitalia when you go to the doctor without giving that a gender.