Could an air conditioner produce power instead of releasing hot air?
I’m going to assume you meant heat pump and not air conditioner since hat is the title of your question.
In theory you could use a heat pump to operate a heat engine that produces electricity. But the very best you can do is to connect a Carnot heat pump to a Carnot heat engine. Because the Carnot heat pump and heat engine are the most efficient possible.
Let's say the Carnot heat pump uses electrical energy to move heat from a low temperature reservoir to a high temperature reservoir. This heat is then taken from the high temperature reservoir as the input to a Carnot heat engine, produces electrical energy as its output while rejecting heat to the lower temperature reservoir. That heat can then be the heat input to the heat pump and so on. The electrical energy output of the heat engine will equal the electrical energy input to the heat pump. The net electrical power produced will be zero.
My guess is that the energy transferred is much less than the energy
needed to compress the gas that transfers the heat.
If I understand what you are saying correctly, your guess is correct. The scenario described above involves the most efficient heat pump and heat engine possible, and results in a "break even" regarding the electrical energy needed and the electrical energy produced. In reality this possibility doesn’t exist as it would constitute a perpetual motion machine (continual circulation of heat). For all real heat pumps and heat engines, you will need more electrical energy to operate the heat pump than you can produce with the heat engine.
Hope this helps.