The cylinder is the part you put your key into; the lock is the mechanism inside the door that moves the bolts. The cylinder works the lock, but they are two separate parts.
Think of the cylinder as the ignition key and the lock as the engine. When you turn the key, the cylinder moves a part called the cam, which pushes the lock mechanism and throws or draws back the bolts.
This matters because very often there is no need to change the whole lock. If you have lost your keys, if the key turns badly or if you want more security, changing the cylinder is normally enough, and it is quicker and simpler. The lock is only changed when it is broken, forced or an old type.
The cylinder is sometimes also called a barrel. More in cylinder replacement.