it could be a cyst have it checked out or a boyle
It's nothing to worry about. It will go away. Its just a plugging of a folical probably. The more you squeeze it and the more you mess with it the worse it will get. Also, it may get infected. Make sure you wash your head back there and change your pillow case on a regular basis. Also, anything new introduced to the area could cause your body to react like the hat. I have had those a number of times on the back of my head in that exact spot and I get my hair buzzed there so it's really annoying. But, don't worry whatever you do.