They only have 23 chromosomes because they go through meiosis instead of mitosis, in mitosis the chromosomes are duplicated so then you have cells with the full 46 chromosomes, however eggs and sperm go through meiosis which doesn’t duplicate the cells because when a sperm (23 chromosomes) and a egg (23 chromosomes) combine then there’s the full 46 chromosomes for the cell.