A CS2 case key is the consumable you need to open a case. Each case needs its own matching key, which you buy from Valve inside the game, as the Counter-Strike wiki describes. The case itself may cost a few cents on the market, so the key is usually the larger part of what an opening costs.
Keys bought since the October 2019 key change are locked to the buyer. They cannot be traded, put on the Steam Community Market or moved to another account. Keys bought before that change stayed tradable and now sell at a premium as collectibles or as a way to move value between accounts.
Why did Valve stop key trading?
Valve said at the time that most key trades it saw had stopped being between real customers and had become a way to move money for fraud. Locking new keys to the buyer stopped keys being used as a currency between accounts. It also meant that anyone who wants to open a case has to pay Valve for the key.
Old tradable keys still exist in small numbers and sometimes trade well above the store price. Buying one to open a case makes no sense, since a new key from the store is cheaper for the same result.
How does the key price affect case opening value?
When you work out whether a case is worth opening, add the key to the case price and compare the total to the average value of the drops. For almost every case that total is higher than the expected value, which is the house edge of case opening. A cheap case is not a cheap opening if you still have to buy the key. The case EV tool does this sum for you.
Third-party case opening sites do not use Valve keys at all. They sell their own openings for site balance, so the term key means nothing there, and their odds and pricing are set by the site, not by Valve.