A cam lock has three main parts:
The body. A threaded or shaped cylinder that passes through a hole in the door, drawer front or panel. It is held in place by a nut on the back, or by a clip, or sometimes by a retaining plate.
The plug. The part that turns when the key is inserted. Inside it are wafers, discs or pins that line up only with the right key.
The cam. A flat bar, sometimes straight, sometimes bent or hooked, fixed to the back of the plug with a screw or nut. When the plug turns, the cam turns with it, swinging behind a frame edge or into a slot to hold the door shut.
Most cam locks turn either 90 or 180 degrees, and the direction can usually be set by how the cam and stop washer are fitted. A cam that is fitted the wrong way round, or with the wrong rotation, either will not lock or will not unlock.