Why do I get erections?

Because extra blood flows to your penis due to sexual excitement or stimulation. The blood fills the tubes in the penis and shuts the valve holding it there until orgasm, climax or stimulation is over, then it returns back to it's normal flaccid state.