Checkpoint inhibitors (CPIs) targeting programmed death 1 (PD-1)/programmed death ligand 1 (PD-L1) and cytotoxic T lymphocyte antigen 4 (CTLA-4) have revolutionized cancer treatment but can trigger autoimmune complications, including CPI-induced diabetes mellitus (CPI-DM), which occurs preferentially with PD-1 blockade. We found evidence of pancreatic inflammation in patients with CPI-DM with shrinkage of pancreases, increased pancreatic enzymes, and in a case from a patient who died with CPI-DM, peri-islet lymphocytic infiltration. In the NOD mouse model, anti-PD-L1 but not anti-CTLA-4 induced diabetes rapidly. RNA sequencing revealed that cytolytic IFN-γ+CD8+ T cells infiltrated islets with anti-PD-L1. Changes in β cells were predominantly driven by IFN-γ and TNF-α and included induction of a potentially novel β cell population with transcriptional changes suggesting dedifferentiation. IFN-γ increased checkpoint ligand expression and activated apoptosis pathways in human β cells in vitro. Treatment with anti-IFN-γ and anti-TNF-α prevented CPI-DM in anti-PD-L1-treated NOD mice. CPIs targeting the PD-1/PD-L1 pathway resulted in transcriptional changes in β cells and immune infiltrates that may lead to the development of diabetes. Inhibition of inflammatory cytokines can prevent CPI-DM, suggesting a strategy for clinical application to prevent this complication.