I don't know what is in your CD player, but it sounds like you are asking in general how to create linear mechanical motion that is electrically controlled.
The most obvious answer is a solenoid. Look around and you will see many different types. These are basically a magnetic plunger moved by the magnetism of a coil.
There are also devices known as voice coils, which are the same concept as a solenoid except that the coil is intended to move. They are called voice coils because this is the mechanism used to make loud speaker cones move.
There are also such things as linear motors. These are like rotary motors with the magnetic poles sortof unwrapped in a line.
Of course rotary motion, such as produced by a electric motor, can be turned into linear motion mechanically. A rack and pinion arrangement is one way. There can also be lever-arm driven mechanisms, which are in turn driven by geared down motors.
Getting accuracy is a separate issue. A basic solenoid is generally intended to be on or off. Voice coils can position quite accurately as a function of current when working against a known mechanical spring force. If a stepper motor is used, then the rotary motion is known open loop, and this can be turned into known linear movement. Otherwise, you will need some kind of mechanical position sensing and closed loop feedback to control the actuator. There are again many types of that, but that's getting too far afield of your question.
Added:
Whoever downvoted this answer, please explain what you think is wrong. Phantom downvotes don't benefit anyone since nobody knows what you object to. It also doesn't give anyone a chance to decide whether you might be wrong.