Good you have noticed it.. You most likely have a tooth cavity which is moderately deep. This is filled with bacteria. Do visit a dentist and get it filled at the earliest. Already u have developed symptoms, so leaving it without a filling will make it spread deeper.
Next Steps
Get a tooth filling at the earliest and the tooth can be saved.
Health Tips
An Dental X Ray maybe required