Its important to note that putting a core in the transformer to wrap the windings around will increase the efficiency.
In a DC motor, the Armature (Basically the coil of which is attached to whatever is going to be turned) is an electro magnet and its polarity is determined by which of the two bushes each side of the coil is in contact with.
There is a field magnet, on smaller motors, a permanent magnet, and in bigger motors, this is also an electromagnet, just a non moving one. As a voltage is put across the motor, a magnetic field builds up around the coil, because there is already a magnetic field already from the field magnet the two interact, and the coil and everything attached to it turns.
However if it was rotated too far the force between the fields would start to move back in the opposite direction, which is why the commutor is there, once the armature rotates past a certain point, the commutor ring that was touching one of the brushes is then touching the opposite brush, the current through the coil is reversed, and it carrys on turning.
Not a great explanation, but its been over 3 years since i picked up my electronics textbook.
An alternator is a sort of reversal of the principal, i.e. the coil is turned rather than being turned, but because it is turning within a fixed magnetic field it produces alternating current as it turns through the field.
Often the field on an alternator is an electromagnet, so the alternator can't generate any current without first having some electricity to set up the magnetic field that the coil will turn in.