Although insects lack the adaptive immunity characteristic of vertebrates, certain species exhibit enhanced subsequent immune responses upon re-encountering a pathogen, a phenomenon known as immune priming. The underlying mechanism of this phenomenon is still elusive. This study evaluated the immune priming of the diamondback moth, Plutella xylostella, induced by a nonpathogenic and commensal bacterium, Bacillus subtilis. Prior exposure of P. xylostella to B. subtilis significantly increased survival against a pathogenic bacterium, Bacillus thuringiensis, compared to larvae without pre-exposure. To extend the effect of the microbial commensals, two antibiotics, ampicillin and kanamycin, were treated to suppress their populations. In the axenic-like condition in the gut, cellular and humoral immune responses were significantly suppressed. An addition of B. subtilis to the diet of P. xylostella significantly enhanced the immune responses. Apolipoprotein D, known as a lipid carrier, acts like a vertebrate lipocalin in the immune priming of the other insect, Spodoptera exigua. The ortholog of this gene has been identified in P. xylostella, and its expression was induced upon B. subtilis treatment. This study sheds light on the potential role of commensal gut microbes, including B. subtilis, in the immune priming of these insects.