Charges moving through a circuit do work against the resistance of the components and wires. The power supply transfers electrical energy to the charges, and when they do work against resistance, this electrical energy is dissipated as thermal energy in the surroundings. Dissipated means the energy is spread out into the surroundings.
The energy is not destroyed. Energy is always conserved, so the total amount stays the same. If a resistor is supplied with 500 J of electrical energy and nothing else happens, all 500 J ends up as thermal energy in the surroundings. However, the energy is now spread out in a way that is hard to use, so it is usually described as wasted.
The greater the resistance of a wire or component, the more energy is dissipated for the same current. This is why a phone charger or a laptop power supply feels warm to touch.