I'd head to the doc for that one. You may have a hernia or something along those lines. When you're turning your head and coughing The doc's not feeling your balls so much as the spot where the tubes come out of your groin and connect to your testes. There's an opening there and sometimes stuff...pops out, hence the hernia. Coughing compresses your abdomen and would make whatever pop out further, that's what the doc's feeling for.
No matter what, groin pain isn't something I'd be putting off getting checked out. There are necessary uses for that...equipment.