Hi...
There can be a lot of reasons for that pain and swelling like any infection, caries, tooth fracture, third molar eruption, TMJ problem.
So to reach onto a proper diagnosis you need to consult first and accordingly treatment plan and medications can be prescribed.
Next Steps
Consult a dentist online/offline soon.
Health Tips
Brush twice daily and do warm saline rinses 2-3 times a day.