Why does my penis get hard when I look at my girlfriend?

That's called arousal - and if you don't know what that is, or why it happens - it's time you started paying attention in class !