First off, glad you are ok and nothing worse.
It is prostatitis which is an inflammation or infection of the prostate. Quick overview. (
https://www.mayoclinic.org/disea ... uses/syc-20355766).
Usually may see blood in urine too, so don't be surprised. Hopefully doc put you on a course of antibiotics and clears it.
The tough part is that it may tend to recur so keep your fingers crossed. You may also end up with BPH-like symptoms including difficulty voiding and incomplete voiding.
Take care.