Aging and immunity are inextricably linked and many genes that extend lifespan also enhance immunoresistance. However, it remains unclear if longevity-enhancing factors modulate immunity and longevity by distinct or shared mechanisms. Here, we demonstrate that the Caenorhabditis elegans pro-longevity factor, NHR-49, also promotes resistance against Pseudomonas aeruginosa, but modulates immunity and longevity by spatially and mechanistically distinct mechanisms. Fenofibrate, an agonist of NHR-49’s mammalian functional homolog, PPARα, enhanced worm immunoresistance in an NHR-49-dependent manner. NHR-49 expression is increased by germline ablation, an intervention that extends lifespan, but lowered by pathogen exposure. NHR-49 acted in multiple somatic tissues to promote longevity, whereas, it’s pro-immunity function was mediated by neuronal expression. The canonical NHR-49 target genes, acs-2 and fmo-2, were upregulated by germline loss, but infection triggered fmo-2 downregulation and acs-2 upregulation. Interestingly, neither gene conferred resistance against Gram-negative Pseudomonas, unlike their reported roles in immunity against Gram-positive pathogens. Thus, NHR-49 is differentially regulated by interventions that bring about long-term changes (lifespan extension) vs. short-term stress (pathogen exposure) and in response it orchestrates distinct outputs, including pathogen-specific transcriptional programs. Overall, our study demonstrates the independent control of immunity and longevity by a conserved regulatory protein.