The generator is like an electric motor in reverse. Instead of applying electricity to it to make it spin, when you spin it, it makes electricity. It does this by spinning a series of windings of fine wire (called the armature) inside of a fixed magnetic field by connecting them to a belt and pulley arrangement on the engine. As the armature is spun by the rotation of the belt and pulley, it gets a current and voltage generated in those windings of wire. That current and voltage will be directly proportional to the speed that the armature spins and to the strength of the magnetic field. If you spin it faster, it makes more and if you make the magnetic field stronger it makes more current. The speed of the spinning is controlled by the speed of the engine - that's why you need to rev the engine up to help charge the battery faster. The magnetic field is controlled by an electro-magnet, so by changing the amount of current supplied to the electro-magnets that make up the field you control the strength of the magnetic field. This current is referred to as the "field" current and it is controlled by the regulator in response to the electrical needs of the automobile at any given time.
The voltage of the generator is controlled by the number of windings in the armature. The current output varies widely from zero if the battery is perfectly charged and nothing is using any power up to the maximum rated output of the generator. The current output is controlled by the field current, but also by the speed at which the armature is spinning. This is important because a generator can only put out it's maximum rated current at or above some speed - at lower speeds the output drops off very quickly. This is why a generator-equipped car will not charge (or even maintain!) the battery at idle and this is one of the main reasons for the development of the alternator.
The current generated in the armature is AC - not DC. To get it converted to DC so it can charge your batter and run your headlights, a device called a commutator is used to "rectify" this situation. It is on the armature and has a series of contacts along it's outer surface. Two spring-loaded brushes slide on the commutator - one brush is connected to ground and the other is connected to the main output of the generator. As the armature and commutator assembly rotates, the brushes come touch the different contacts on the commutator such that the polarity of the current moving in the armature is always connected to the correct brushes. The net effect of this is that the generator output is always DC even though the current inside the armature windings is always AC.
The key different between an alternator and a generator is what spins and what is fixed. On a generator windings of wire (the armature) spin inside a fixed magnetic field. On an alternator, a magnetic field is spun inside of windings of wire called a stator to generate the electricity. This allows the wires to be directly and easily connected to their outputs without the need for sliding contacts to carry the relatively high output current. The magnetic field is still generated via electro magnets mounted on a rotor, and the relatively small field current that powers them is supplied to the rotor by two small brushes that each ride on a separate and continuous slip rings. These smooth slip rings (unlike the comparatively rough contacts on a commutator in a generator) and the fact that the relatively heavy windings are fixed instead of rotating allows the alternator to be spun to much higher speeds. This allows it to reach it's maximum output sooner and to be spun fast enough at engine idle speeds to produce enough electricity to power most (if not all) of the needs of the car without relying on the battery.
There are typically three separate windings of wire in the stator that are all set to so that the AC current that is generated is slightly out of phase in each one. The peaks and valleys of the rising and falling current do not happen at the same time, rather they are staggered a bit. This increases and smoothes the electrical output of the alternator much the same way that a 8 cylinder car runs more smoothly than a 4 cylinder one does - there are more power pulses happening in each revolution allowing more total power and better smoothness.
The process of rectifying the AC current into DC current is handled inside the alternator by something more complex than a commutator - diodes. A diode is a "solid state" device that allows current to flow in one direction only - "solid state" means it does this without any mechanical or moving parts. It relies on the different electrical properties of the materials it is made of to act as a one-way valve for current. By arranging diodes so that current from each of the three stator wires is only allowed to pass in one direction, and by connecting the three outputs together, you get a reasonably smooth and stable DC output without any moving parts. (This arrangement is typically manufactured as a single part and is referred to as the diode pack or diode trio.) This lack of moving parts makes the alternator not only very reliable - but also comparatively inexpensive to build and repair.