The x-ray is not very clear. There seems to be bone obstruction behind the tooth.
If gum swelling is occurring repeatedly, the best solution is to get the tooth removed. Do not fear, the tooth is in a straight position, extraction may not be complicated.
Next Steps
Meanwhile take pain killers and rinse your mouth with warm salt water 2-3 times a day. Take antibiotics prescribed by your doctor.