Why cant you stay hard you are a healthy 18 year old boy and when your girlfriend and you try to have sex you lose your erection you have no problem any other time?

You may not be as interested in your girlfriend as you think you are or very possibly, you are trying too hard. Over thinking it instead of just going with the flow. You may also be worried about getting her pregnant, getting caught, how well you will do, will she be impressed or not. It is something in your head that is causing it, not your penis.