Could be a insect part has punctured its inner gum line, leading to swelling. Watch for infection, as you dont want it leading to canker (big infection).
If it gets worse, discoloration becomes apparent, or you find cheesy material around the gum, see your vet.