ABSTRACT Background Depression is associated with adverse effects in patients with autoimmune hepatitis (AIH). However, the underlying mechanism remains unclear. This study explores the impact of depression and related intestinal microbiota on immune‐mediated hepatitis. Methods We assessed depression in 260 AIH patients receiving 2‐year standardized treatment and 173 healthy controls. In mice, depressive‐like behaviors were induced by chronic unpredictable mild stress (CUMS), and immune‐mediated hepatitis was induced by intravenous injection of concanavalin A (ConA). Fecal microbiota transplantation (FMT) was performed using samples from patients with major depressive disorder (MDD) and controls. Results Depression was common in patients with AIH (106/260, 40.8%) and was associated with cirrhosis. Compared with nondepressed AIH patients, those with depression showed exacerbated intestinal barrier dysfunction and hepatic NLR family pyrin domain containing 3 (NLRP3) inflammasome overactivation. In the ConA‐induced hepatitis model, CUMS exposure aggravated these abnormalities, which were then attenuated by mirtazapine. Furthermore, mice colonized with MDD microbiota exhibited greater intestinal barrier disruption and hepatic NLRP3 inflammasome overactivation than those colonized with control microbiota. Notably, gut‐derived Lactococcus formosensis , isolated from the livers of MDD microbiota‐colonized mice, could translocate to the liver and induce hepatic NLRP3 inflammasome overactivation. In addition, vaccination against L. formosensis prevented translocation and alleviated liver injury in monocolonized mice. Conclusion Depression aggravates immune‐mediated hepatitis through disruption of intestinal barrier integrity and overactivation of hepatic NLRP3 inflammasome. Gut‐derived L. formosensis could translocate to the liver and induce liver injury in mice. This study provides the necessity of screening for depression in patients with AIH.