Inventors find out how stuff works. They run experiments that help us understand the world and make it better. When you do enough experiments and get the same results each time, you find "natural rules" around you--things that are always true.
One of those interesting things scientists learned is that when they run electricity through a coil of copper wire, they can create a temporary magnet. When the electricity is on, the magnet works. When it's off, the magnet stops. It happens every single time!
Electromagnets in our lives
Above is an "invention" known as a doorbell. You probably have one on your front door, though it looks a little bit nicer, and the wires are hidden in the wall.
On this funny-looking doorbell, when you press the switch that connects the battery to the copper wire, a tiny bit of electricity (the bit that fits into two AA batteries) can finally run all the way through the long coil of wire. We know that when you run current through a long coil, you get a magnet. The magnet pulls a metal lever which rings the bell. Thus, by pressing the switch, you can ring a bell. Doorbell! See it in action in this video.
Electromagnets in our airplane
Part of the engine starting system in a general aviation airplane is what is called a "solenoid". A solenoid is an electromagnet. It's a special device that takes advantage of that universal truth that when you "run a current through a coil you get a magnet".
When we want to power our electronics (like the lights) in the airplane, we flip the master switch to the "ON" position. This connects the battery to a coil, which runs current through the coil and creates a magnetic field that attracts a lever to the magnet. That lever moves to connect the battery to the main bus that powers all of our electrical devices.
Without the solenoid, the battery would always be connected to the main bus, which would drain the battery. The solenoid makes sure that the battery remains disconnected from all electrical units until the master switch is turned on.
Try it at Home
The electromagnet kit in the picture above is part of the Edu Science "Know-How" kit from Toys 'R Us. It's a bit flimsy and the plastic won't stand up to rough use, but it gets the point across. There are 9 other experiments in the same kit, of varying levels of difficulty. Ages 8+. You can buy one here.