Cancer immunotherapy with chimeric antigen receptor (CAR) T cells can cause immune effector cell-associated neurotoxicity syndrome (ICANS). However, the molecular mechanisms leading to ICANS are not well understood. Here we examined the role of microglia using mouse models and cohorts of individuals with ICANS. CD19-directed CAR (CAR19) T cell transfer in B cell lymphoma-bearing mice caused microglia activation and neurocognitive deficits. The TGFβ-activated kinase-1 (TAK1)-NF-κB-p38 MAPK pathway was activated in microglia after CAR19 T cell transfer. Pharmacological TAK1 inhibition or genetic Tak1 deletion in microglia using Cx3cr1CreER:Tak1fl/fl mice resulted in reduced microglia activation and improved neurocognitive activity. TAK1 inhibition allowed for potent CAR19-induced antilymphoma effects. Individuals with ICANS exhibited microglia activation in vivo when studied by translocator protein positron emission tomography, and imaging mass cytometry revealed a shift from resting to activated microglia. In summary, we prove a role for microglia in ICANS pathophysiology, identify the TAK1-NF-κB-p38 MAPK axis as a pathogenic signaling pathway and provide a rationale to test TAK1 inhibition in a clinical trial for ICANS prevention after CAR19 T cell-based cancer immunotherapy.