The purpose of this study is to explore the risk of coronary heart disease (CHD) in cancer patients who consume different flavonoids, and the impact of flavonoids on the prognosis of cancer patients with CHD. We extracted dietary flavonoids data on 1454 patients diagnosed with cancer from the National Health and Nutrition Examination Survey and Food and Nutrient Database for Dietary Studies. Logistic regression analysis was used to explore the relationship between the intake of flavonoids and the risk of CHD. Cox proportional hazard model was used to explore the impact of flavonoids intake on prognosis in 148 patients with cancer and CHD. Malvidin intake increased the risk of CHD by 1% [odds ratio (OR) = 1.01, 95% confidence interval (CI): 1.00–1.02, P < 0.05] in cancer patients, while epicatechin and isorhamnetin reduced the risk of CHD by 3% (OR = 0.97, 95% CI: 0.94–1.00, P < 0.05) and 15% (OR = 0.85, 95% CI: 0.72–1.00, P < 0.05), respectively. Adjusted by age, sex, and race, malvidin intake increased the risk of CHD in cancer patients by 1% (OR = 1.01, 95% CI: 1.00–1.02, P < 0.05), isorhamnetin decreased the risk by 15% (OR = 0.85, 95% CI: 0.72–1.00, P < 0.05), and epicatechin showed no effect on the risk of CHD (P > 0.05). No flavonoids had impact on the prognosis of patients with cancer and CHD (P > 0.05). For patients with cancer, consuming malvidin increases the risk of CHD, while isorhamnetin reduces the risk. Consuming flavonoids has no impact on the prognosis of patients with cancer and CHD.