Thanks for your query.
you have Cavity in your teeth so when you take food some particles goes inside & gets infected resulted in to gingivitis
so you have gum swelling.
You need to visit Dentist
who just check all teeth & If he feels Roots of your teeth is OK suggest you Root canal treatment
& after that filling of cavity advised so no particles goes inside & you get relief of it.OK Thanks.