Magnetism with a switch
Pass an electric current through a wire and a magnetic field appears around it. Wind the wire into a coil and the fields of the loops add together, concentrating into a strong field along the coil's axis — one end behaves as a north pole, the other as a south. Add an iron core and the effect multiplies, as the iron itself becomes magnetised and joins in.
The defining feature is control. Switch the current on and the magnet exists; switch it off and the magnetism vanishes almost completely. Reverse the current and the poles swap ends. No permanent magnet offers any of that.
Turning the strength up and down
An electromagnet's strength is adjustable in ways a bar magnet's never can be. More turns of wire in the coil, a larger current, or a better iron core all make it stronger. Engineers dial in exactly the magnetism a job needs, from the faint pull in a doorbell to forces that lift cars.
That doorbell is a neat demonstration: press the button and current flows, the electromagnet yanks a hammer against the bell, the movement breaks the circuit, the magnetism dies, a spring pulls the hammer back — and the circuit reconnects to repeat the cycle dozens of times a second.
The electromagnet at large
Scrapyards use electromagnets as cranes: lower the magnet onto a wrecked car, switch on, lift; position it over the truck, switch off, and the car drops. A permanent magnet that strong would be useless — nothing could ever be unloaded from it.
The same principle spins every electric motor, opens and closes countless valves and relays, and — in superconducting form, cooled until resistance vanishes — generates the immense steady fields inside MRI scanners. Magnetism you can switch is one of the foundation technologies of the modern world.

