Memory CD4 T cells are critical to human immunity, yet it is unclear whether viral inflammation during memory formation has long-term consequences. Here, we compared transcriptional and epigenetic landscapes of Spike (S)-specific memory CD4 T cells in 24 individuals whose first exposure to S was via SARS-CoV-2 infection or mRNA vaccination. Nearly 2 years after memory formation, S-specific CD4 T cells established by infection remained enriched for transcripts related to cytotoxicity and for interferon-stimulated genes, likely because of a chromatin accessibility landscape altered by inflammation. Moreover, S-specific CD4 T cells primed by infection had reduced proliferative capacity in vitro relative to vaccine-primed cells. Furthermore, the transcriptional state of S-specific memory CD4 T cells was minimally altered by booster immunization and/or breakthrough infection. Thus, infection-associated inflammation durably imprints CD4 T cell memory, which affects the function of these cells and may have consequences for long-term immunity.