This study investigated the effects of replacing commercial feeds with fresh black soldier fly larvae (BSFL) on the immune enzyme activities, water quality in the culturing environment, and intestinal microbiota of Pacific white shrimp (Litopenaeus vannamei). Five different feeding regimes were designed, in which 0% (control group), 25%, 50%, 75%, and 100% commercial feeds were replaced with equal wet weight of fresh BSFL, respectively. The experiment lasted for 45 days, and the results showed that the serum T-NOS (total nitric oxide synthase), AKP (alkaline phosphatase), and ACP (acid phosphatase) activity were significantly increased in the BSFL25% group. However, the immune enzymes of the hepatopancreas decreased significantly in all the BSFL-containing groups compared to the control group. Total ammonia nitrogen concentrations throughout the experimental phase and nitrate concentrations in the middle and later phases of the experiment were negatively correlated with the replacement rate of fresh BSFL in the diet, whereas pH was positively correlated with the replacement rate of fresh BSFL in the diet. Proteobacteria and Bacteroidetes were dominant phyla in the intestines of shrimps, but the relative abundances of Proteobacteria and Firmicutes decreased, with those of Bacteroidetes and Planctomycetes increased in the BSFL-containing groups. Among them, higher relative abundances of potential probiotics such as Motilimonas, Shimia, Pseudoalteromonas, and Shewanella and lower relative abundance of genus Vibrio were observed in the fresh BSFL-containing groups. Furthermore, shrimps fed with BSFL-containing diets had higher bacterial richness and diversity in the intestines. In conclusion, a proper replacement of commercial feed with fresh BSFL had a positive effects on the immune-related enzyme activities, water quality, and intestinal health in the L. vannamei.