Sexually dimorphic behavior is pervasive across animals, with males and females exhibiting different mate selection, parental care, foraging, dispersal, and territorial strategies. However, the genetic underpinnings of sexually dimorphic behaviors are poorly understood. Here we investigate gene networks and expression patterns associated with sexually dimorphic imprinting-like learning in the butterfly Bicyclus anynana. In this species, both males and females learn visual preferences, but learn preferences for different traits and use different signals as salient, unconditioned cues. To identify genes and gene networks associated with this behavior, we examined gene expression profiles of the brains and eyes of male and female butterflies immediately post training and compared them to the same tissues of naive individuals. We found more differentially expressed genes and a greater number of significant gene networks in the eye, indicating a role of the peripheral nervous system in visual imprinting-like learning. Females had higher chemoreceptor expression levels than males, supporting the hypothesized sexual dimorphic use of chemical cues during the learning process. In addition, genes that influence B. anynana wing patterns (sexual ornaments), such as invected, spalt, and apterous, were also differentially expressed in the brain and eye, suggesting that these genes may influence both sexual ornaments and the preferences for these ornaments. Our results indicate dynamic and sex-specific responses to social scenario in both the peripheral and central nervous systems and highlight the potential role of wing patterning genes in mate preference and learning across the Lepidoptera.