Optical zoom is achieved by mechanically moving the optical elements in a lens to effectively bring the image closer. Because it is done optically, the resulting image maintains its quality.
 
Digital zoom however can be misleading. What digital zoom actually does is basically crop a portion of the image and electronically enlarges it back to size, usually by interpolation. The result is generally a much lower quality image, typically image detail is lost and looks pixilated.