Hi, Welcome to HealthcareMagic Forum.
May be you have Epididymo Orchitis
. Kindly get yourself examined by a Urologist
to rule out the exact cause and if necessary you may want to get a Ultrasound
You may need antibiotics and apply heat pads regularly when you feel more pain.
Wish you Good Health.