Based on your explanation it seems to be that you are having problems in your wisdom tooth. Since you say that it's very painful, first take medications after visiting a dentist, once the pain subsides then you need to remove the tooth, that would be the best treatment if it involves your wisdom tooth.
In case if it's not your wisdom tooth, probably you can try saving that molar tooth by doing rct if possible.
Next Steps
Visit your dentist at the earliest and get to know which tooth has the problem exactly and then you will be given treatment plan.
Health Tips
If you delay your visit you might get the infections more severe, so visit early and get treated fast.