Take as an example a light bulb inside a lamp to illuminate a room. When you plug it in a plug and turn it on, light is generated. More precisely, heat (Joule effect) is produced inside the lamp by its internal filament (conductive material) when it passes through the electrical energy, generated by the friction of the atoms that are inside it when it encounters a resistance.