The cause of swelling is pus formation. its might due to gum problem or due to cavity which reach to root and caused pus formation.you have to visit dentist for consultation to find out the reason. bacause the traetment is depend on the cause of pus formation.