What could be wrong a 7 yr old boy is in pain near his groin? A hernia?

Yes. There could be many things wrong. A hernia is one of them. You should have this young man evaluated by his primary care physician.
Could be. 7 year old should not have pain, possible it could be a inguinal hernia, take to his pediatrician.