The high adaptability of insects to food sources has contributed to their ranking among the most abundant and diverse species on Earth. However, the molecular mechanisms underlying the rapid adaptation of insects to different foods remain unclear. We explored the changes in gene expression and metabolic composition of the Malpighian tubules as an important metabolic excretion and detoxification organ in silkworms (Bombyx mori) fed mulberry leaf and artificial diets. A total of 2436 differentially expressed genes (DEGs) and 245 differential metabolites were identified between groups, with the majority of DEGs associated with metabolic detoxification, transmembrane transport, and mitochondrial function. Detoxification enzymes, such as cytochrome P450 (CYP), glutathione-S-transferase (GST), and UDP-glycosyltransferase, and ABC and SLC transporters of endogenous and exogenous solutes were more abundant in the artificial diet group. Enzyme activity assays confirmed increased CYP and GST activity in the Malpighian tubules of the artificial diet-fed group. Metabolome analysis showed increased contents of secondary metabolites, terpenoids, flavonoids, alkaloids, organic acids, lipids, and food additives in the artificial diet group. Our findings highlight the important role of the Malpighian tubules in adaptation to different foods and provide guidance for further optimization of artificial diets to improve silkworm breeding.