The energy generated is related to the difference in temperature. So if you're using AC out as hot and ambient as cold, the generation will be small, and it's necessarily much less than the energy spent to run the AC.
Some people have proposed this as yet another bulk energy storage system for the grid; giant underground cryotanks of liquid nitrogen. With careful design the same gear could be used in "forwards" or "reverse" mode. The limit is that the Carnot efficiency isn't great.
Both the Stirling engine and the AC unit are using the Carnot cycle (simplification), and going around the expansion-heat-transfer cycle in opposite directions.