Okay thanks. So in a young adult with a recent issue, there are few causes, but psychological ones are the most likely.
Physiologically you know everything was fine as it was working. Things that can then impact this is over exposure, i.e. watching pornography, regular masturbation. Lifestyle factors will impact this such as depression, anxiety, stress, smoking, drugs, alcohol, poor sleep, lack of exercise.
I would strongly consider these first and just give yourself time and abstain for a week or two as well.
If however this doesn't work, if you have ever had sex, go get sexual health screening. If this is normal, then bloods to assess your testosterone.