When making sperm, the X and Y chromosomes are drawn apart in the first division in meiosis. There's a 50% chance each sperm cell gets a Y-chromosome. A similar thing happens when making eggs. But the original cell has two X-chromosomes, so all the eggs have one X-chromosome