The increasing global prevalence of type 2 diabetes mellitus (T2DM) necessitates investigating its complex etiology. This study aimed to explore the relationship between exposure to toxic metals, expression of endoplasmic reticulum stress response (ERSR) genes, and various biochemical parameters, including glycated hemoglobin (HbA1c), insulin resistance (HOMA-IR)/sensitivity (QUICKI), lipid profile, and estimated glomerular filtration rate (eGFR) in T2DM patients. T2DM patients and control subjects were matched for age, gender, and lifestyle factors. Biochemical parameters, toxic metal levels, and ERSR gene expression were analyzed using inductively coupled plasma mass spectrometry (ICPMS) and quantitative reverse transcription PCR (qRT-PCR), respectively. T2DM patients exhibit dysregulated lipid profiles and significantly higher fasting blood sugar (FBS), HbA1c, and insulin levels (all p < 0.0001). The insulin sensitivity was lower in T2DM patients (0.32 ± 0.09) than in the control group (0.35 ± 0.02, p = 0.02). Insulin resistance was significantly higher in the T2DM group (5.38 ± 3.15) than in the control group (1.98 ± 0.86, p = 0.0001). Nickel (4.75 ± 2.45 ppb, p < 0.0001) and arsenic (1.85 ± 1.78 ppb, p < 0.0001) levels were significantly elevated in T2DM patients. There was significant upregulation of ER stress genes: GRP78, CHOP, IRE1, ATF4, ATF6, and XBP1 (all p < 0.0001), while PERK was significantly down regulated (0.68-fold, p < 0.0001). Nickel levels were positively correlated with HOMA-IR (r = 0.49, p < 0.0001) and HbA1c (r = 0.35, p = 0.002). Arsenic levels were correlated with insulin (r = 0.34, p < 0.0001), insulin resistance (r = 0.51,p < 0.0001), HbA1c (r = 0.53, p < 0.0001), Arsenic levels (β = 0.37, p < 0.001), XBP1 (β = 0.36, p < 0.0001) independently associated with HbA1c.This study has revealed a significant association between arsenic exposure and the upregulation of XBP1 at the onset of T2DM. The overexpression of XBP1 and high levels of arsenic were independently associated with HbA1c and insulin resistance.