The history and photo suggests a wisdom tooth which lacks sufficient space to erupt.
This is a frequent cause of gum swelling at the back. When there is insufficient space for the wisdom tooth to erupt, there is typically gum that covers part of it.
This condition is called pericoronitis and is known to be painful. The best way of management will require removal of the wisdom tooth. However you can have some antibiotics, painkillers and a mouthwash as an interim measure.
Removal of the wisdom tooth procedure is relatively painless and can be a quick procedure.
Since you are 17yrs of age, you should come with one of your parents or a guardian who can give consent for the surgical removal. Hope it gets better soon.
Best Regards,
Dr Samintharaj Kumar