It could pure anxiety or it could be overuse of Internet porn. Those are your two options at your age. Or it may be a combo of the two.
Do you use Internet porn for masturbation? Several men who have recovered from porn-induced ED described what you have described - getting hard then going limp when trying to penetrate. With sexual foreplay dopamine rises to cause erections. When one pauses to penetrate, or worse yet, put on a condom, the dopamine may drop slightly. Men who use porn start to notice this symptom at the beginning stages for the problem. Part of the problem may be related to no longer having the visual stimulation when you get into position to penetrate. Porn conditions the brain for visual stimulation as we all know.
If you use porn to masturbate, and have for awhile, Follow this libnk and read the posts. See if you can relate. Control+find my first 2 posts, and follow the links to articles and video presentations that explain everything.