Hey guys I am having this wierd situation I get erection w

Hey guys
I am having this wierd situation
I get erection while i watch porn or i masturbate looking at a sexual photo or something.
But just recently i met with my girlfriend and we both are virgins. And we tried to have sex but..... At starting i didn't even get an erection, and after that i got erect but lost it within a minute.
I could not penetrate. As soon as i tried to enter her i lost my erection.
But when i came to my home i got erection while thinking of all the time we spent together.
I am extremely depressed about this situation that i could not be manly when i was with her.
I'm ashamed.
Is it because i was addicted to porn for long time amd now i could not respond to a real girl?
Why did it happen.
Do i have ED?

It could be anxiety, the first time having sex there is so much pressure, especially if you think it is going to go anything like how you have seen with porn. How is your girlfriend? Have you two talked about what happened?

I agree with CKBlossom. If the problem persists see a urologist.

Did you try Viagra (Sildenafil) or Cialis (Tadalafil).?These can often overcome psychological issues.The sure way to get over it is trimix injections. Do talk to an Urologist.