It is most likely a ganglionic cyst or synovial cyst.
These are mobile and compressible, like a ball with air in it, not hard like a rock. Please see your primary care physician for diagnosis and treatment. Corticosteroid injections can shrink it. if you rest your hand and the pain doesn't improve, you may need an orthopedic hand specialist's opinion.