Helminth infections in children are associated with impaired cognitive development; however, the biological mechanisms for this remain unclear. Using a murine model of gastrointestinal helminth infection, we demonstrate that early-life exposure to helminths promotes local and systemic inflammatory responses and transient changes in the gastrointestinal microbiome. Behavioral and cognitive analyses performed 9-months postinfection revealed deficits in spatial recognition memory and an anxiety-like behavioral phenotype in worm-infected mice, which was associated with neuropathology and increased microglial activation within the brain. This study demonstrates a previously unrecognized mechanism through which helminth infections may influence cognitive function, via perturbations in the gut-immune-brain axis.