The idea behind an electron microscope is that electrons, which we usually first learn to be "particles", have also wavelike properties due to quantum mechanics. As light, which is nothing else than electromagnetic waves with wavelengths of between about 400 and 800 nm (nano-meters) our eyes are sensitive too, is described by a wave equations, which can be derived from Maxwell's equations, within quantum theory electrons are described by a wave equation, the Schrödinger equation.
The same math that explains, how the rules of geometrical optics follow from wave optics based on Maxwell's equations, also explains the particle aspects of the electrons. Since electrons carry electromagnetic charge (one negative elementary charge) you can deflect them with electric and magnetic fields, and you can tailor your fields such that they act like lenses do for light.
The advantage of electron microscopes compared to optical ones is that it is easy to manipulate electrons which have a much smaller wave length. This is important, because the wave length is also a measure for the ability to resolve small structures, i.e., the smaller structures you want to observer the higher resolution you need and thus you need waves with low wave length.
Electromagnetic waves of shorter wave lengths are UV-, X-, and finally ##\gamma## rays, but the electromagnetic radiation of such shorter wave lengths is not easily manipulated, because they just go through the material pretty unaffected and thus it is hard to construct lenses for them.
For electrons it's easier, because to get short wavelengths you just need electrons with higher momenta (larger velocities, because ##p=m v##). The Einstein-de Broglie formula then tells you that the wave length of electrons with a momentum ##p## is ##\lambda=h/p##, where ##h## is Planck's quantum of the action, ruling quantum physics. Further, as already mentioned above, you can use electric and magnetic fields as lenses for the electron waves, and this enables to construct electron microscopes using indeed ideas very similar to optics, enabling in this way pictures which can resolve much smaller structures than with an optical microscope.