Hello and hope you are doing well.
The swelling is unlikely to be due to brain cancer. It could be enlarged lymph node/nodes. Lymph are protective mechanisms of the body and they 'trap' the infecting source causing enlargement of lymph nodes. The infection can be from the draining skin or the organs. The other causes for enlarged nodes are tumors or inflammations to name a few. The swelling and pain could also be due to mastoiditis, which is infection of the bone behind the ear. This happens when there is a middle ear infection, which spreads to involve the mastoid bone. You may need to consult your primary care physician who will examine you and initiate appropriate therapy.
Hope this helped and do keep us posted.