There isn't a single "main cause" that fits every man — but if you had to name the biggest one, it's blood flow. An erection is fundamentally a cardiovascular event: arousal triggers blood vessels in the penis to relax and fill with blood, and anything that narrows or damages those vessels makes an erection harder to get or keep. That's why the leading causes of ED overlap so heavily with the causes of heart disease.
The practical takeaway: ED is rarely "just in your head," and it's rarely one thing. Most men have a mix of contributing factors, which is exactly why figuring out the cause matters before choosing a treatment.