Unraveling the origin of molecular pathways underlying the evolution of adaptive traits is essential for understanding how new lineages emerge, including the relative contribution of conserved ancestral traits and newly evolved derived traits. Here, we investigated the evolutionary divergence of sex pheromone communication from moths (mostly nocturnal) to butterflies (mostly diurnal) that occurred ~119 million years ago. In moths, it is the females that typically emit pheromones to attract male mates, but in butterflies males emit pheromones that are used by females for mate choice. The molecular bases of sex pheromone communication are well understood in moths, but they have remained relatively unexplored in butterflies. We used a combination of transcriptomics, real time qPCR, and phylogenetics to identify genes involved in the different steps (i.e., production, regulation, and reception) of sex pheromone communication of the butterfly Bicyclus anynana. Our results show that the biosynthesis and reception of sex pheromones relies both on moth-specific gene families (reductases) and on more ancestral insect gene families (desaturases, olfactory receptors, odorant binding proteins). Interestingly, B. anynana appears to use what was believed to be the moth-specific neuropeptide Pheromone Biosynthesis Activating Neuropeptide (PBAN) for regulating sex pheromone production. 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 investigation of the genetic pathways underlying sex pheromone communication in a butterfly.