Hello and hope you are doing well.
The swelling could be a lymph node. It could also be a sebaceous cyst, a boil or an insect bite. Lymph node enlargement is usually due to infections like bacterial and viral. The source of infection for you appears to be on the scalp. Treatment is usually with antibiotics and anti-inflammatory medications. So, consult your primary care physician for proper clinical assessment. In the meantime for pain relief you can use OTC Tylenol (acetaminophen).
Hope this helped and do keep us posted.