You used the energy from the wall socket to pump the heat from outside into the inside, less efficiently than you could use that heat to generate more electricity or do other work later.
Aka you pumped the energy inside and concentrated it a bit. You didn't generate more energy than you had before. You did make existing energy more useful for you, comfort wise.
Actually operating one, you'll see that the energy cost of a heat pump becomes proportionally higher as the temperature difference gets bigger, so you spend more energy moving the heat when the source is low temperature and the output is high temperature.
Many people have gotten quite frustrated when they end up chilling the ground in their ground source heat pump too much, and they end up with very inefficient systems.
You could do the exact same thing (with better or similar efficiency) by using some other source of thermal mass. Air sourced heat pumps do it with the atmosphere. It's possible to use lakes and other bodies of water.
No net usable power is being extracted from the earth in this scenario. The earth is being cooled in order to heat your house. And heated, in order to cool your house.
Geothermal power systems do produce actual usable power, and they do so by running a heat engine (the opposite of a heat pump) off an extremely large temperature difference from a very large source of underground heat. You can't run a heat engine on the output of a heat pump and produce net power, anymore than you can hook a generator to an electric motor and produce net power.