Helminth diseases have long been a threat to the health of humans and animals. Roundworms are important organisms for studying parasitic mechanisms, disease transmission and prevention. The study of parasites in the living fossil giant panda is of great significance for understanding the adaptation mechanism of roundworms to the host. Here, we report a high-quality chromosome-scale genome of Baylisascaris schroederi with a genome size of 262 Mb and 19,291 predicted protein-coding genes. We found a significant expansion of genes related to epidermal chitin synthesis and environmental information processing in roundworms genome. Furthermore, we demonstrated unique genes involved in essential amino acid metabolism in the B. schroederi genome, inferred to be essential for the adaptation to the giant panda-specific diet. In addition, under different deworming pressures, we found that four resistance-related genes (glc-1, nrf-6, bre-4 and ced-7) were under strong positive selection in captive population. Finally, 23 known drug targets and 47 potential target proteins were identified. The genome provides a unique reference for inferring the early evolution of roundworms and the mechanisms underlying adaptive. Population genetic analysis and drug prediction provide insights for revealing the impact of deworming history on population genetic structure and prevention.