The somatic cell of human beings has 23 pairs of chromosomes. Out of them, the 23rd pair contains sex chromosomes.
In a male, the somatic cell has X and Y chromosomes in 23rd pair. In females, the somatic cell has XX chromosomes in 23rd pair.
So, a sperm can have either X or Y chromosome as the 23rd chromosome. On the other hand, an egg has an X chromosome as the 23rd chromosome. When a sperm with an X chromosome fertilizes the egg, the resulting zygote develops into a girl child. When a sperm with a Y chromosome fertilizes the egg, the resulting zygote develops into a male child.