On sexual stimulation, blood flow to the penis increases through pelvic & penile arteries. Simultaneously, the veins in the penis get occluded which results in retention of blood & engorgement of the penis.
Interruption in blood flow to the penis or inability of the penis to retain blood result in vascular ED.