The testis is a key male reproductive organ that produces gametes through the process of spermatogenesis. Testis morphologies and spermatogenesis evolve rapidly in mammals, presumably due to the evolutionary pressure on males to be reproductively successful 1,2 . The rapid evolution of the testis was shown to be reflected at the molecular level based on bulk-tissue work 3-8 , but the molecular evolution of individual spermatogenic cell types across mammalian lineages remains largely uncharacterized. Here we report evolutionary analyses of single-nucleus transcriptome data for testes from eleven species that cover the three major mammalian lineages (eutherians, marsupials, egg-laying monotremes) and birds (the evolutionary outgroup), and include seven key primates. Our analyses reveal that the rapid evolution of the testis is driven by accelerated fixation rates of gene expression changes, amino acid altering substitutions, and newly emerged genes in late spermatogenic stages – likely facilitated by reduced pleiotropic constraints, haploid selection, and a transcriptionally permissive chromatin environment. We identify temporal expression changes of individual genes across species, which may have contributed to the emergence of species-specific phenotypes, but also conserved expression programs underlying ancestral spermatogenic processes. Sex chromosome analyses show that genes predominantly expressed in spermatogonia (i.e., germ cells fueling spermatogenesis) and Sertoli cells (i.e., somatic supporting cells) independently accumulated on X chromosomes across mammals during evolution, presumably due to male-beneficial selective forces. Further work uncovered that the process of meiotic sex chromosome inactivation (MSCI) also occurs in monotremes and hence is common to the different mammalian sex chromosome systems, contrary to previous inferences 9 . Thus, the general mechanism of meiotic silencing of unsynapsed chromatin (MSUC), which underlies MSCI, represents an ancestral mammalian feature. Together, our study illuminates the cellular and molecular evolution of mammalian spermatogenesis and associated selective forces, and provides a resource for investigating the biology of the testis across mammals.