This study investigates the association between the triglyceride glucose (TyG) index and heart failure (HF) using data from the National Health and Nutrition Examination Survey (NHANES) 2007–2018. The TyG index, calculated as the natural logarithm of fasting triglyceride (mg/dL) multiplied by fasting glucose (mg/dL) divided by 2, was found to be positively associated with the risk of HF. A total of 13,825 participants were analyzed, including 435 individuals with HF and 13,390 without HF. Those with HF had a higher TyG index (8.91 ± 0.74) compared to those without HF (8.57 ± 0.66). The odds ratio (OR) for HF was 1.644 in Model 1 (unadjusted) and 1.057 in Model 4 (adjusted for all covariates). The TyG index showed a linear dose–response relationship with HF risk in Model 1 (p = 0.686). The TyG index predicted an area under the receiver operating characteristic (ROC) curve of 0.602 (95% CI: 0.575–0.629, p < 0.001) with an optimal cutoff value of 8.91. The study also found a significant "J-shaped" dose–response relationship between the TyG index and HF risk, with a rapid increase in HF risk when the TyG index exceeded 8.91. The TyG index may serve as a therapeutic target and an important predictor of HF. The study highlights the importance of the TyG index in assessing insulin resistance and its potential role in the development of HF. The findings suggest that the TyG index could be a valuable tool for early identification and management of HF risk.This study investigates the association between the triglyceride glucose (TyG) index and heart failure (HF) using data from the National Health and Nutrition Examination Survey (NHANES) 2007–2018. The TyG index, calculated as the natural logarithm of fasting triglyceride (mg/dL) multiplied by fasting glucose (mg/dL) divided by 2, was found to be positively associated with the risk of HF. A total of 13,825 participants were analyzed, including 435 individuals with HF and 13,390 without HF. Those with HF had a higher TyG index (8.91 ± 0.74) compared to those without HF (8.57 ± 0.66). The odds ratio (OR) for HF was 1.644 in Model 1 (unadjusted) and 1.057 in Model 4 (adjusted for all covariates). The TyG index showed a linear dose–response relationship with HF risk in Model 1 (p = 0.686). The TyG index predicted an area under the receiver operating characteristic (ROC) curve of 0.602 (95% CI: 0.575–0.629, p < 0.001) with an optimal cutoff value of 8.91. The study also found a significant "J-shaped" dose–response relationship between the TyG index and HF risk, with a rapid increase in HF risk when the TyG index exceeded 8.91. The TyG index may serve as a therapeutic target and an important predictor of HF. The study highlights the importance of the TyG index in assessing insulin resistance and its potential role in the development of HF. The findings suggest that the TyG index could be a valuable tool for early identification and management of HF risk.