The instruction for determining the sex of the baby is present in the thread-like structures, called chromosomes in the fertilized egg. Chromosomes are present inside the nucleus of every cell. All human beings have 23 pairs of chromosomes in the nuclei of their cells. Two chromosomes out of these are the sex chromosomes, named X and Y. A female has two X chromosomes, while a male has one X and one Y chromosome. The gametes (egg and sperm) have only one set of chromosomes. The unfertilized egg always has one X chromosome. But sperms are of two kinds. One kind has an X chromosome, and the other kind has a Y chromosome. When a sperm containing X chromosome fertilizes the egg, the zygote would have two X chromosomes and develop into a female child. If the sperm contributes a Y chromosome to the egg (ovum) at fertilization, the zygote would develop into a male child.
x chromosome = female
Sometimes, male gives the x chromosome, sometimes y and then the sex is determined.
Hope I helped!