This happens due to the cavity or infection which has progressed till the nerve(pulp) inside your tooth, you must visit a dentist and get root canal done for that tooth,further delay may lead to more swelling ,pain and fever, and it would be difficult to save that tooth.
Next Steps
visit a dentist and get Root canal done..(might need extraction of tooth,if it is way too damaged.