Electromagnetism

       For every type of speaker is a permanent magnet with a coil of wire sitting inside it.

Magnet+Wire
The permanent magnet is there to have a consistent magnetic field.

The wire has electricity moving through it which will cause it to generate a magnetic field of its own.  Unlike the permanent magnet, the wire's magnetic polarity can be changed.  This is done by changing the direction of the current going through the wire. 

By changing the orientation of the magnetic poles, the wire will either be puled toward the permanent magnet or be pushed away from it.  The rapid pushing and pulling is what is used for creating the vibrations of air.