Cameras that use digital zoom capture an image, and then zoom in on it by enlarging the pixels on a certain area. Digital zoom is limited by the camera’s resolution: the higher the resolution, the better quality the zoomed in image will be.
Cameras that use optical zoom can change the focal length of the lens to zoom in and out. The closer the lens is to the sensor, you will see a far wider angle (zoomed out). Alternatively, the further the lens is from the sensor, will display a more narrow angle (zoomed in).