Food-derived bioactive compounds are promising candidates for enhancing host immune defense. Here, we established an integrated screening strategy combining immunodeficiency-related gene mining, compound-target mapping, food-derived component annotation, and drug-likeness evaluation to identify candidate immunomodulators. Highly relevant immunodeficiency-associated genes were screened from GeneCards, and active compounds targeting these genes were retrieved from ChEMBL (pChEMBL ≥ 6). These compounds were cross-referenced with the food-derived components from FooDB, followed by network-based target analysis and rule-based drug-likeness filtering. Using this pipeline, resveratrol was prioritized as a representative candidate. In the Caenorhabditis elegans-Pseudomonas aeruginosa PA14 infection model, resveratrol significantly improved host survival, with 0.5 mM showing the strongest protective effect. This concentration also enhanced body length, locomotion, and lifespan without causing developmental delay. Fluorescence analysis suggested that resveratrol improved lysosomal and mitochondrial homeostasis and reduced infection-associated cellular damage. Integrated transcriptomic analysis and genetic validation demonstrated that resveratrol-mediated protection required intact p38 MAPK signaling and DAF-16 activity, and resveratrol promoted DAF-16 nuclear localization. Moreover, parental resveratrol treatment enhanced PA14 resistance in untreated offspring through both maternal and paternal lineages, with the heritable effect persisting for at least three generations. These findings identify resveratrol as a food-derived candidate with host-protective activity that promotes pathogen resistance and induces heritable host defense through p38 MAPK- and DAF-16-dependent mechanisms, highlighting the potential of dietary interventions for immune modulation and transgenerational health benefits.