Gene duplication followed by adaptation to new selection pressures has been proposed to be of central importance in the evolution of venom toxins. Coupling high-quality genome data with quantitative bioactivity readouts can be used to understand how venom toxins evolved, but such studies are rare. Here, we report a near chromosomal-level genome assembly for Doratifera vulnerans (Lepidoptera: Limacodidae), which is venomous in the larval stage. We identify 115 gene loci that produce the polypeptide toxins in venom, including numerous multigene families as well as single-copy genes. Previously described membrane-permeabilizing peptides that cause pain are shown to be encoded by a gene cluster on chromosome 7 that also encodes multiple members of the cecropin family, which are insect innate immunity peptides. These data reveal the origin of defensive toxins from immune peptides followed by strong sequence divergence driven by positive selection pressures. Dv13, which is present as a trace component in the venom, and which has sequence features conserved with canonical cecropin A, potently inhibited the growth of Gram-negative bacteria and fungi, but only weakly permeabilized the membranes of mammalian neurons with EC 50 values >100 µM. In contrast, peptides Dv11 and Dv12 are abundant in the venom, have sequence features divergent from Dv13, and potently disrupt mammalian neuronal membranes with EC 50 values as low as 190 nM, but have reduced antimicrobial activity. These data provide evidence for the adaptation of innate immune peptides as specialized defensive venom toxins and provide a natural experiment informing the structure–activity relationships of cecropin family peptides.