Double glazing is formed from two panes of glass sealed together, with a gap left between them, to form a double glazed unit. The air trapped inside the window (or gas depending on the rating of double glazing you have fitted) creates an insulating barrier that keeps heat in.
It is only when the seal on the glass breaks, or fails as is known in the industry that condensation gets into the window, resulting in a misted up window. The seal can break for a number of reasons, but is mainly due to bad fitting, the age of the window, how it was manufactured, how it was originally fitted or any chemical cleaning material used on the window overtime that might have damaged the seal.