Probable hydrocele. Sounds like a hydrocele which is a "bag" of fluid around the testicle. This is best corrected by hydrocelectomy. This is a simple outpatient scrotal operation. Unless it is a hernia, in which case you need a groin operation for hernia repair. Have the swelling checked out, might need an ultrasound to rule out testis tumor.
Depends on the cause. Not enough info is it a hernia? An orchitis (infection)? A hydrocele?