How maternal nutrition influences neonatal immune development and imprinting through breastfeeding remains largely unclear. We report that maternal supplementation with trans-vaccenic acid (TVA), the predominant naturally occurring trans-fatty acid in human breast milk, promoted neonatal T cell development in mice. Neonates fed by mothers on a TVA-enriched diet showed an expanded naïve cluster of differentiation 4 (CD4+) T cell population and enhanced adaptive immunity against infection. TVA reprogrammed neonatal naïve CD4+ T cells through a G protein-coupled receptor-CCCTC-binding factor axis and promoted T helper cells (Th1)-skewing by cooperating with the transcription factor TBX21. Early-life exposure to maternal TVA via breastfeeding supported long-lasting antiviral immunity in adulthood. Our findings establish the multifaceted benefits of maternal nutrition and breastfeeding via TVA in promoting infant immune homeostasis and protective immunity.