Ulcerations. Apthous ulcerations are one possible explanation for sores on the gums. Trauma or localized reaction to an irritant are other possibilities. Use warm salt water rinses and give it a few days. If the pain is severe or persistent, get to a dentist and have it checked out.
See your dentist. Multiple things can cause this. It may be a virus of some kind, or it may be related to a more general health problem. It would be best to visit your dentist.