They come from the Y chromosome and appear before the sex of the embryo has developed, just in case it turns out to be female.
Discussion
Meant to say X chromosome but that’s the reason.
to further add, human are generally neuter until the specific male chromosome start doing its action
Exactly. The gonads develop first because reproduction is the most important function of the body. The chromosomes determine which sex the fetus will be after the organs have already begun to form.