Painful testicles warrant a visit to your local doctor/health care professional.
There is a condition called torsio testis and that is an emergency which requires immediate attention and action as you would otherwise lose the functionality of the testicle.
May be not so likely that it is that but without seeing it can not discount it (although less likely that you go to the gym with this condition as it is extremely painful)
So get to see your doc soonest is the message.
FD