Sex is determined at conception by the sperm. Since women have XX sex chromosomes, eggs will always have an X chromosome. Since men have XY sex chromosomes each sperm has a 50-50 chance of containing either an X chromosome or a Y chromosome. If an X-sperm fertilizes the egg you get a girl (XX), if a Y-sperm fertilizes the egg you get a boy (XY).