Yup sounds like, infected hair follicles that can turn into boils.
One common cause is shaving because when you shave you leave a hard end on the hair instead of the natural "fine point" and this can result in the hair growing under the skin instead (in grown hair).
Your doctor maybe able to help the healing process or may just tell you to keep it clean and use an antibacterial cream on it - doctors differ in their opinons so it's best to get the advice from your own health care professional.
Usually once they burst, so long as the gunk all come sout and you clean it well and disinfect/use anti-baterial ointment it should be fine.
If it doesn't clear within a couple days, gets bigger quickly, is painful, bleeds or keeps coming back then definately see your health care professional.