New lineages can arise through mosaic evolution of conserved, ancestral traits, and newly evolved, derived traits. Unraveling the origin of molecular pathways underlying the evolution of adaptive traits is essential for understanding how new lineages emerge. Here, we investigated the evolutionary divergence of sex pheromone communication from moths (mostly nocturnal) to butterflies (mostly diurnal) that occurred ~98 million years ago. In moths, females typically emit pheromones to attract male mates, but in butterflies pheromones are produced by males, a chemical signal on which females largely base their mate choice. The molecular bases of sex pheromone communication are well understood in moths, but have remained virtually unexplored in butterflies. Using a combination of transcriptomics, real time qPCR, and phylogenetics, our results suggest that the butterfly Bicyclus anynana relies on some moth-specific gene families (reductases) and on more ancestral insect gene families (desaturases, olfactory receptors, odorant binding proteins) for the biosynthesis and reception of sex pheromones. Interestingly, B. anynana further appears to use what was believed to be the moth-specific neuropeptide Pheromone Biosynthesis Activating Neuropeptide (PBAN) for sex pheromone regulation. Altogether, our results suggest that a mosaic pattern best explains how sex pheromone communication evolved in butterflies, with some molecular components derived from moths, and others conserved from more ancient insect ancestors. This is the first large-scale analysis of the genetic pathways underlying sex pheromone communication in a butterfly.