Hi, one of the reasons for this could be your wisdom tooth not having erupted completely. Food tends to get stuck under the gum and causes infection,also if you are continuously biting on the gum it will get inflamed and swell up. You need to get it checked by a dentist for correct diagnosis and treatment.
Next Steps
Warm salt water gargles and application of a soothing gel might help temporarily till you go for a check up.