To understand how a wireless charger works, we need to take a look at how magnetism and electricity are related. It's a relationship that makes possible hundreds of different types of electronic devices!
First, let's take an electromagnet. It's easy to make a simple electromagnet — all you need is a battery, some insulated copper wire, and an iron nail. Wrap the wire around the iron nail, leaving enough wire on either end to connect to the battery. Make sure each time you wrap around the nail that you're going in the same direction. The more coils you make around the nail, the stronger your electromagnetic induction will be.
Once you've got your nail wrapped in insulated wire, you can connect the two ends of the wire to the terminals on a battery. Electricity flows through the coiled wire, generating a magnetic field along the nail. You can use the nail to pick up other nails through magnetism. If you switch the ends of the wire to the opposite terminals on the battery, you'll reverse the polarity of your electromagnet — what was the north end of the magnet becomes the south end, and vice versa.
If you assemble a second transmitter coil of wire and place it near the first, you can use the magnetic field from your electromagnet to create a flow of electrons in the second coil. If you hook that second coil of wire to a voltmeter, you can actually see the needle or readout change whenever you connect or disconnect the wires from the battery. That's because exposing a coil of wire to a changing magnetic field can induce electricity to flow through that wire. The key is that the magnetic field must change to keep electricity flowing — a stable magnetic field won't work as an inductor.
A battery provides electricity in a direct current, as electricity always flows in the same direction. But if you hook up an electromagnetic to an alternating current — a circuit in which electricity flows first in one direction and then the other many times per second — you alternate the polarity of the electromagnet in time with the changes in the current's direction. That creates a constantly changing magnetic field — the perfect condition for inducting electricity.