What is optical zoom?
Optical zoom involves a physical camera lens movement, which changes the apparent closeness of the image subject by increasing the focal length. It is also referred to as a "true zoom," as it changes a lens' focal length and magnification by physically extending and retracting the lens. This zooming action usually takes place inside the camera, but can often be heard making a sound similar to a small motor. Your camera does this by moving different lens parts relative to each other. That is why the lens moves when you zoom in with an optical zoom. This brings you closer to the image without losing quality. Note: you do not zoom in with every lens at all without lens errors. For example, lens errors express themselves in contrast reduction and blur.
What is digital zoom?
If your camera has digital zoom, it zooms in on a specific part of the image. That part is then increased to the total number of megapixels your camera sensor has. In fact, a piece of image is cut out and brought to the correct size. With cameras with a high resolution, it is possible to zoom in without too much loss of quality. If you zoom too far for the size of the sensor, your image will be out of focus.
What are the main difference?
In short, with optical zoom you first get the subject close before you capture it. With digital zoom, your camera uses part of the image and later brings it to the correct size. With digital zoom, you therefore have more chance of quality loss. Compare it to an image that is too small and enlarged to make pixels visible.