How do the chromosomes determine a person's sex?

Sex - Basic Aspects of Human Sexuality

The Role of Chromosomes:
How do the chromosomes determine a person's sex?

Human body cells contain 46 chromosomes, of which 2 determine a person's sex: In the female body they are two X-chromosomes (44+XX), in the male body they are one X-chromosome and one Y-chromosome (44+XY). However, before an egg cell matures and becomes ready for fertilization, it loses half of its chromosomes (result: 22+X). Similarly, before it reaches its full maturity, a sperm cell loses half its chromosomes (result: either 22+X or 22+Y). During fertilization the two remaining halves unite to form a new complete cell. Thus, the new cell may have either 44+XX or 44+XY chromosomes. Accordingly, it will develop in the direction of either a female or male individual. However, at the embryonic stage, the two are still outwardly indistinguishable.