When a doctor injects steroid into a cyst on a hand or wrist, what does the steroid actually do inside the cyst?

Inflammation. Steroids are potent anti-inflammatories. When injected into a cyst, they decrease the inflammation, with the hope that the cyst resolves.
Steroid in cysts. Cysts contain keratin, the protein of skin. The outer layer of skin gets trapped within a cyst and at some time, the wall of the cyst can rupture and the content leak into the surrounding dermis creating a lot of inflammation, redness, pain and swelling which is reduced by teh corticosteroid. Steroid injections also decr. The fibroblast cell from making more collagen and minimizes scar formation.