Sex-specific traits and behaviors emerge during development by the acquisition of unique properties in the nervous system of each sex. However, the genetic events responsible for introducing these sex-specific features remain poorly understood. In this study, we create a comprehensive gene expression atlas of pure populations of hermaphrodites and males of the nematode Caenorhabditis elegans across development. We discover numerous differentially expressed genes, including neuronal gene families like transcription factors, neuropeptides, and G protein-coupled receptors. We identify INS-39, an insulin-like peptide, as a prominent male-biased gene expressed specifically in ciliated sensory neurons. We show that INS-39 serves as an early-stage male marker, facilitating the effective isolation of males in high-throughput experiments. Through complex and sex-specific regulation, ins-39 plays pleiotropic sexually dimorphic roles in various behaviors, while also playing a shared, dimorphic role in early life stress. This study offers a comparative sexual and developmental gene expression database for C. elegans. Furthermore, it highlights conserved genes that may underlie the sexually dimorphic manifestation of different human diseases.