There are 3 main problems with a conventional dryer, which heat pump dryers aim to solve.
They are creating heat rather than moving it.
To boil away 1 pound of water out of your wet clothing, a dryer must bring 1100 BTU* of heat. Traditional dryers (gas or electric) create 1100 BTU of heat. That means either a) burning 1100 BTU of gas heat locally, or b) burning 2750 BTU of gas heat at the electric power plant.
They are sucking unconditioned outside air into your house.
The basic energy-efficiency requirement of modern appliances is they don't do that. If they need process air, they should bring it in from outdoors via a separate stack -- like a direct-vent furnace or a 2-hose portable air conditioner.
The reason is we are trying to make buildings relatively airtight, to control not only the temperature but also the moisture content of the air inside. Moisture content is very expensive to add or remove - again it takes 1100 BTU to add or remove 1 pound of water (because it must be boiled or condensed).
So what do conventional dryers do? Same thing as 1-hose A/Cs or 70% furnaces -- they steal their process air from conditioned air already in the room. You can't remove air from a room and just have less air. The pressure differential will cause outside air to leak in via every leak - which means that conditioned air it ejected is being replaced by outside air at Nature's choice of humidity and temperature. So now you must spend energy to re-condition that air.
And if your house is "nice and tight" like we like modern homes to be, it can actually draw negative pressure in the room, causing it to suck outside air in from any other parasitic-vented appliance. So now combustion air is moving backwards through your 70% gas furnace, dragging hot air into places inside that 70% furnace hot air was never meant to go, and filling the house with combustion products.
They have an exhaust vent in the first place
Which itself is a building penetration that invites all sorts of trouble, from maintenance hassles to sources of "cold draft" to vermin entry paths. In California, the #1 threat isn't earthquakes, it's wildfire. And often, you see burnt houses right next to unburnt ones in the same field of devastation. Why? Burning embers getting sucked in building penetrations is one common reason. Or for that matter, plastic fittings (e.g. dryer vent exhausts). A fire-resistant house doesn't want any vents it can avoid.
How do heat pumps solve the "creating heat" problem?
The key to understanding heat pumping is that the "temperature floor" is not zero degrees C, or even zero degrees F. The temperature floor is zero degrees Kelvin. That is 273 centigrade, meaning 293K (20C) is a comfortable house interior and water boils at 373K **. So you see, it's not such a big job to "pump" heat from 293 to 373.
So... rather than create heat, the heat pumps simply pump the heat that's already there.
The heat pump dryer takes airstream #1 and cools it to 278K (40F/5C). It takes the heat it stole, and puts it into airstream #2, which it warms, say, 393K (250F/120C, over boiling). It then runs airstream #2 through your clothing, causing water to boil out of it and causes this hot airstream to become saturated with water (100% humidity at that temperature; hotter air can hold a lot more water than cold).
So pumping 1100 BTU can happen at 300-800% efficiency, depending on temperature of the intake air to airstream #1. (the less "uphill" you're pumping heat, the more efficient it is). And that's more efficient than the gas power plant! So yes, it's more efficient to burn the gas at the power plant than locally, even if we ignored the "air ejection" problem.
Now what do we do with this hot, wet air?
Remember airstream #1? It wants hot air to steal heat from. Match made in heaven: the evaporator here gets nice hot air to steal heat from, which makes it yet more efficient still. This chills the air greatly. Cold air can't hold nearly as much water as hot air, so as a bonus side-effect, it also condenses the water in the airstream. The water is collected and pumped into the washing machine's drain.
How do heat pumps avoid exhaust vent / sucking in outside air?
Well, what air is left to vent outside? The exhaust of the condenser (heater) goes straight into the clothing, and then into the evaporator. The exhaust of the evaporator (dry air) goes back into the condenser.
Thus the whole system is a "closed loop". Add a lint filter and we're done. Air never leaves the building - it doesn't need to. So, no exhaust vent needs to exist.
And since air never leaves the building, it's not sucking air in through every orifice in the building.
An environmental aspect is versatility
Although this is true of any electric dryer.
Anytime you are using electric instead of gas, you are no longer making CO2 yourself. You are drawing electric, which is an intermediate form of energy, which can be sourced from a huge variety of sources. As your energy mix shifts from gas toward renewables, your electric dryer will automatically do so - whereas a gas dryer will be gas for its life.
Or for instance, there is a glut of solar in the mornings when the sun is out in full force, yet it hasn't warmed houses enough to need A/C yet. Running a dryer at that time shifts your energy mix toward solar.
Electric can benefit from pumped storage and if you look at the California aqueduct system, the whole system is built for pumped storage.
* Wait, isn't the latent heat of boiling only 970 BTU? Only if the liquid water is at boiling temperature. If it's at room temperature you'll need to add 142 BTUs to get it to/from boiling temp also.
** Or in Fahrenheit, you add 460F, so "comfortable" is 530 Rankine and boiling is 672 Rankine. Rankine is like Kelvin, but with Fahrenheit intervals (so 1.8x deg K).