Though hernias are quite common among men, most guys don't actually know what they are -- they only know it's something they don't want. You can get hernias in all different places on your body, but generally, a hernia occurs when a portion of fatty tissue or intestine squeezes through its "container" -- often the abdominal wall. Imagine a sausage casing splitting open and letting some of its contents poke through.
If you have testicular pain, you could have an indirect inguinal hernia, which occurs near the seam where your thigh meets your body. Why would it make your testicles hurt? The hernia travels the same route your testicles took when your body was forming as a fetus.
That pathway starts in the abdomen and ends in the scrotum, following the pathway your fetal testicles took as they descended from your abdomen. And that just may be where your indirect inguinal hernia has ended its journey -- in your scrotum, the location of your pain and discomfort.