Probably a sebaceous/ganglion cyst
(put simply, a clogged sweat gland
that forms a sack of fluid that eventually hardens). My doctor said they're pretty common in the hands and wrist. I had a pretty embarrassing one on the underside of my eyebrow close to my eye, which is pretty rare. The good thing is that the procedure to remove it is fairly simple. You can either have it drained (they shove a needle into it and squeeze out what looks like thick puss from a zit. Only downside to this method is you have a 73% chance of it coming back) or have an outpatient procedure done where they cut it out. Some doctors, like mine, will just do it in their office.
As for the pain, if it IS a ganglion cyst, the pain is probably coming from it being in an area where it's allowed to cause pressure on the joint. Mine being in an area where it was pretty much just allowed to grow, I never experienced any pain.