Hi sir...
It may be due to broken filling and secondary infection of the tooth....
If there is any broken filling you need to refilling done....
Proper clinical examination is necessary to diagnose the cause
Next Steps
Kindly visit the dentist as early as possible to rectify this problem....
Health Tips
If you delay, the cavity may extends in to nerve layer(inner layer)and the pain may arise which needs to treat by Root canal treatment only....