From an evolutionary point of view, male sex evolved as an evolutionary adaptation for stronger genes through sexual reproduction to face climatic changes. For mammals, male and female with distinctly different genes evolved 180 million years ago -- around the same times as marsupials. Which means some where down in history we had only ONE sex and the male sex evolved very slowly through many millions years.
Hence "sex" is a relative term and is not only determined by your genes but also by your hormones as well. For instance even if you have male genes you can still have females characeristics if your hormones are not working properly.
Even the fetus is initially asexual and later develops in to male or female characteristics depending on your genes and hormones - therefore there are intermediaries in sex - males females and other intermediaries.
Modern day Examples of intermediaries - caster semanya
Note - this is for those interested in biology, not for religious idiots who still belive in an imaginary fairy and thinks their imaginary fairy created man and woman