Hi,
Based on the information it seems like a Infection of some kind of
cyst commonly known as "ABSCESS"
Here is some information that will help you understand what your are going through and what is the treatment.
let me explain what do I mean, their are glands(bunch of cells modified to do certain things) called sebaceous glands which secrete the sweat and an oily substance called sebum, they have an opening at one end and closed at other like a bottle normally it can get the production out from the opening but due to one or other reason the opening is closed/sealed and hence the production of sweat / sebum can't come out so it starts building up and it seems like a bump still at this time it will be painless, but slowly it might get infected and the infection makes it painful which is present in your case.
ADVICE:
you need to consult your doctor.
Here is they most likely do
1) will take a visual inspection
2) prescribe some antibiotic and pain medication
3) if nothing works they need to make a small cut to drain the pus and collected sebum , may not need to make even a cut some cases they can just put a needle and drain out the stuff.
Hope it helps.