Diet plays a crucial role in shaping the gut microbiota and overall health of animals. Traditionally, silkworms are fed fresh mulberry leaves, and artificial diets do not support good health. The aim of this study was to explore the relationship between the dietary transition from artificial diets to mulberry leaves and the effects on the gut microbiota and physiological changes in silkworms as a model organism. With the transition from artificial diets to mulberry leaves, the diversity of the silkworm gut microbiota increased, and the proportion of Enterococcus and Weissella, the dominant gut bacterial species in silkworms reared on artificial diets, decreased, whereas the abundance of Achromobacter and Rhodococcus increased. Dietary transition at different times, including the third or fifth instar larval stages, resulted in significant differences in the growth and development, immune resistance, and silk production capacity of silkworms. These changes might have been associated with the rapid adaptation of the intestinal microbiota of silkworms to dietary transition. This study preliminarily established a dietary transition–gut microbial model in silkworms based on the conversion from artificial diets to mulberry leaves, thus providing an important reference for future studies on the mechanisms through which habitual dietary changes affect host physiology through the gut microbiome.