Because it's an amphetamine and, like all amphetamines, it constricts the blood vessels via its effect on alpha-1 receptors. An erection is the result of vagal dilation of said vessels, so it makes sense for a sympathomimetic agent to have the opposite effect.
While we're on the subject, know that Trazodone is likely to CAUSE priapism. You'll likely see it on an exam at some point.