Why do i get an erection when i poop?

Whenever i go to the bathroom and go poop, i get an erection. it usually only happens when its solid and fairly large.

why do i get an erection when i'm just sitting there not even thinking of anything sexual?

i'm not trying to be disgusting. i just really want to know.
Update: I'm not gay. I don't enjoy it. It just gets hard. idk
Update 2: why are so many girls interested in this question?
18 answers 18