However, the story of the discovery
of sperm has originated more than three centuries ago, in 1677. Without any
scientific purpose and purely driven by human curiosity, van Leeuwenhoek and
his assistant described animalculae in human semen. It was not until 1776 that
interest in the "new male gamete" began to focus on its physiology.
Spallanzani noted that it became motionless when cooled by snow. Additionally,
Spallanzani performed the world’s first artificial insemination of a viviparous
animal.
https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6018180/
With the introduction of the microscope in the 17th century sperm were discovered in the semen. Studies involving impregnation of amphibian eggs revealed that single sperm could produce a foetus.
Despite this information the mammalian egg remained undiscovered for another 200 years. Finally, Karl Ernst von Baer discovered the ovum by microscopic examination of the ovarian follicle contents of the dog.