It seems like infected sebaceous cyst
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.
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.