The Anti-Fog process comes in two parts - built into the lenses, and in a cloth impregnated with a special customized, long lasting solution.
The two parts work together to make the surface of the lenses more hydrophilic (‘water loving’). That might sound counter-productive, but read on. Most regular glasses have a hydro-phobic coating (anti-reflective) to reduce reflections. This is why your normal glasses fog up easily in your goggles or your helmet. Because the water is repelled into droplets, leaving a film on your lens.
With Anti-Fog treatment, when the temperature changes, water droplets are attracted to the lens surface. However the anti-fog treatment interrupts and minimizes the surface tension. This means that the condensation spreads out evenly over the lens surface, making it all but invisible to the eye. Yay for science!