Hernias can cause pain and more commonly when they are intermitently stuck or incarcerated in the defect.
The will usually also cause some local bulging at the site of the hernia
as well. You should have this issue evaluated by a medical professional and consider treatment if it is frequent or changes your ability to do normal daily activities.
This can easily be seen on physical exam by your doc