Trimethyltin chloride (TMT) is a stabilizer for polyvinyl chloride plastics that causes serious health hazards in nontarget organisms. Melatonin (MT) exhibits powerful protective effects in cardiac diseases. As a new environmental pollutant, TMT‐induced cardiotoxicity and the protective effects of MT remain unclear. To explore this, the mice were treated with TMT (2.8 mg/kg) and/or MT (10 mg/kg) for 7 days. Firstly, the histopathological and ultrastructural evaluation showed that TMT induced cardiac damage, tumescent rupture and nuclear pyknosis. Moreover, TMT elevated the expressions of pyroptosis genes NLRP3, ASC and Cas1 and inflammation factors IL‐6, IL‐17 and TNFα. Secondly, TMT reduced antioxidant enzymes (GSH, CAT and T‐AOC) via decreasing the expression of genes associated with the Keap1‐Nrf2/ARE pathway to increase oxidative stress. Thirdly, TMT decreased the expression of genes associated with the ARE‐driven drug metabolizing enzymes (DMEs), including Akr7a3, Akr1b8, and Akr1b10. Besides, TMT upregulated the mRNA expression of nuclear Xenobiotic metabolism on cytochrome P450s enzymes via increasing the expression of CAR, PXP, and AHR genes. Furthermore, MT treatment mitigated the aforementioned adverse changes induced by TMT. Overall, these results demonstrated that TMT caused pyroptosis and inflammation to aggravate cardiac damage via inducing excessive oxidative stress, imbalance of DMEs homeostasis, and nuclear Xenobiotic metabolism disorder, which could be alleviated by MT.