One of the most striking examples of sexual dimorphism is sex-limited mimicry in butterflies, a phenomenon in which one sex—usually the female—mimics a toxic model species, whereas the other sex displays a different wing pattern1. Sex-limited mimicry is phylogenetically widespread in the swallowtail butterfly genus Papilio, in which it is often associated with female mimetic polymorphism1, 2, 3. In multiple polymorphic species, the entire wing pattern phenotype is controlled by a single Mendelian ‘supergene’4. Although theoretical work has explored the evolutionary dynamics of supergene mimicry5, 6, 7, 8, 9, there are almost no empirical data that address the critical issue of what a mimicry supergene actually is at a functional level. Using an integrative approach combining genetic and association mapping, transcriptome and genome sequencing, and gene expression analyses, we show that a single gene, doublesex, controls supergene mimicry in Papilio polytes. This is in contrast to the long-held view that supergenes are likely to be controlled by a tightly linked cluster of loci4. Analysis of gene expression and DNA sequence variation indicates that isoform expression differences contribute to the functional differences between dsx mimicry alleles, and protein sequence evolution may also have a role. Our results combine elements from different hypotheses for the identity of supergenes, showing that a single gene can switch the entire wing pattern among mimicry phenotypes but may require multiple, tightly linked mutations to do so.