K.T.
I wonder if it could be a hernia? Testicular torsion? The pain could be from the infection itself.
There are so many things it could be including more serious things like a bone infection. Obviously a doctor will have to figure it out. If he doesn't get better [I would say 24 hours after your first visit to the hospital] or gets worse at any time, I would take him to the ER again- if you show up for a second time, they will likely do more testing to actually figure out the real cause. In fact, if the Tylenol and Motrin really aren't helping at all, they would probably recommend you come back anyway.
In my experiences with my son, it seems like most doctors prefer to send you home and see if it goes away. The vast majority don't actually work hard to find the real issue on your first visit, which makes sense, because they shouldn't be doing all kinds of expensive tests for something like a strain. So you have to 'play their game', and you should expect to always be the one to advocate for his health. If you know something more is going on, you have to demand more care. I hope he gets better soon