Herbivorous insects and host plants have developed a close and complex relationship over a long period of co-evolution. Some plants provide nutrients for insects, but plants’ secondary metabolites also influence their growth and development. Urtica cannabina roots and leaves are poisonous, yet Aglais urticae larvae feed on them, so we aimed to clarify the mechanism enabling this interaction. At present, studies on the detoxification mechanism of the A. urticae are rare. In our study, first, we used the A. urticae larval odor selection behavior bioassay and choice feeding preference assay to analyze the feeding preferences of A. urticae on its host plant, U. cannabina. Next, we used transcriptome sequencing to obtain the unigenes annotated and classified by various databases, such as KEGG and GO. In this study, we found that U. cannabina could attract A. urticae larvae to feed via scent, and the feeding preference assay confirmed that larvae preferred U. cannabina leaves over three other plants: Cirsium japonicum, Cannabis sativa, and Arctium lappa. The activity of detoxifying enzymes GST and CarE changed in larvae that had consumed U. cannabina. Furthermore, through transcriptomic sequencing analysis, 77,624 unigenes were assembled from raw reads. The numbers of differentially expressed genes were calculated using pairwise comparisons of all life stages; the expression of detoxification enzyme genes was substantially higher in larvae than in the pupal and adult stages. Finally, we identified and summarized 34 genes associated with detoxification enzymes, such as UDP-glucose 4-epimerase gene, 5 Glutathione S-transferase genes, 4 Carboxylesterase genes, 4 Cytochrome P450 genes, 10 ATP-binding cassette genes, 4 Superoxide dismutase, and Peroxidase. Moreover, we identified 28 genes associated with the development of A. urticae. The qRT-PCR results were nearly consistent with the transcriptomic data, showing an increased expression level of four genes in larvae. Taken together, this study examines the correlation between A. urticae and host plants U. cannabina, uncovering a pronounced preference for A. urticae larvae toward host plants. Consistent with RNA-seq, we investigated the mechanism of A. urticae’s interaction with host plants and identified detoxification-related genes. The present study provides theoretical support for studying insect adaptation mechanisms and biological control.