for sperm formation its known as spermatogenesis and for egg formation its oogenesis. And meiosis play vital role in this. As meiosis changes our normal diploid cell to haploid cell so that on fertilization of both haploid sperm and haploid egg it forms a diploid zygote