Memory and specificity are hallmarks of the adaptive immune system. Contrary to prior belief, innate immune systems can also provide forms of immune memory, such as immune priming in invertebrates and trained immunity in vertebrates. Immune priming can even be specific but differs remarkably in cellular and molecular functionality from the well-studied adaptive immune system of vertebrates. To date, it is unknown whether and how the level of specificity in immune priming can adapt during evolution in response to natural selection. We tested the evolution of priming specificity in an invertebrate model, the beetle Tribolium castaneum. Using controlled evolution experiments, we selected beetles for either specific or unspecific immune priming toward the bacteria Pseudomonas fluorescens, Lactococcus lactis, and 4 strains of the entomopathogen Bacillus thuringiensis. After 14 generations of host selection, specificity of priming was not universally higher in the lines selected for specificity, but rather depended on the bacterium used for priming and challenge. The insect pathogen B. thuringiensis induced the strongest priming effect. Differences between the evolved populations were mirrored in the transcriptomic response, revealing involvement of immune, metabolic, and transcription-modifying genes. Finally, we demonstrate that the induction strength of a set of differentially expressed immune genes predicts the survival probability of the evolved lines upon infection. We conclude that high specificity of immune priming can evolve rapidly for certain bacteria, most likely due to changes in the regulation of immune genes.