Certain genes cause chemical reactions that result in the development of testes. Embryos are gonadally identical, regardless of genetic sex, until a certain point in development; then the testis-determining factor causes male sex organs to develop, while lack of this factor will cause the embryo to develop as physically female.
The TDF factor is encoded by the SRY gene located in the Y chromosome. It is a DNA binding protein, that enhances other transmission factors, or is a transcription factor itself. Its expression directly or indirectly causes the development of primary sex cords, which will later develop to seminiferous tubules. These cords form in the central part of the undifferentiated-yet gonad, turning it into a testis. The testis then starts secreting testosterone and the Mullerian Inhibiting Substance.
Older texts discuss the role of the HY antigen in the control of testicular development, but this was later disproven.
Role in disease
The TDF gene has some interesting implications. The genetic recombination of Crossing over can cause the gene to be transferred on to the X chromosome. In this case, the X chromosome will initiate testis development, so regardless of whether the person has a Y chromosome, the person will turn into a male. Though everything else will be developed as if it were a female (other sex related alleles), the apparent sex will be male (a syndrome known as XX male syndrome).
Conversely, such a cross-over event also can result in a Y chromosome that is missing its TDF, replaced with the corresponding sequence from the end of the X chromosome. Individuals who inherit this Y chromosome will develop as females, despite having the normal male chromosomal set of one X and one Y. However, the lack of two X-chromosomes gives complications to such females, called Turner syndrome.