An Indirect Inguinal Hernia will pass down into the scrotum and it follows the same path as the testicles did when they moved from the abdomen to the scrotum whilst the boy was in his mother's womb.
A Direct Inguinal Hernia is a different type and rarely passes into the scrotum.
Femoral and Inguinal Hernia's are the types most often associated with the groin area. The Hernia is either a bulging out section of the large intestine or sometimes fatty tissue. It is not a muscle.
I took my own son to the GP just before his second birthday a few years ago. The boy had a unevenly distended pair of testicles and I knew what it was before I saw the doctor. The doctor felt his nuts to eliminate a variocele and a few other things, confirmed what I thought and I rushed him off to one of the teaching hospitals attached to my uni for emergency inguinal hernia surgery. The protruding part of the intestine was essentially pushed back into the abdominal cavity and held in place with a biologically inert mesh before the wound was closed
So yes, depending on the type of hernia, it can be necessary for a doctor to feel the testicles.
All the same, there's more to it than that. An experienced pair of hands on your nuts can detect a variocele, tumour, hernia, spermatocele, testicular torsion, hydrocele and in the young, an undescended testicle.