Sex of a baby is determined at the time of conception and
genetic factors play a critical role.
Humans have XX-XY sex determination system (Female contain XX
chromosome in the allosome pair and Male contains XY chromosome in
the allosome pair). The presence of SRY gene (sex determining
region) on the Y chromosome determines maleness. This gene is Y
linked as it is present only on the Y chromosome.
In males, the SRY gene is involved in the activation of
different other genes that causes the development of gonads as
testes. On the other hand, in female since SRY gene is absent
therefore gonads develop as ovaries.