How do the different sexes first develop?

Sex - Basic Aspects of Human Sexuality

The Role of Chromosomes:
How do the different sexes first develop?

If the new fertilized cell contains two X-chromosomes, the embryo will eventually form ovaries. However, if a Y-chromosome is present, it stimulates the undifferentiated gonadal cell mass to develop into testicles. The testicles, in turn, produce the hormone testosterone which further advances the process of the embryo turning into a male.