That's an easy question. I'll assume in this answer, for the purposes of PhysicsOverflow, that you have at least a basic knowledge of quantum field theory.

Heterotic strings, as their name suggests, arise as a "hybrid" of a bosonic string and a Type II superstring. This "hybrid" is formed by the left-movers of the bosonic string and the right-movers of the Type II string.

Now, Bosonic strings are consistent only in 26-dimensional spacetime. The consistency argument depends on the type of quantisation that you use. If you use canonical quantisation to quantise your bosonic string, then one needs a central charge of 26 to cancel out the negative-norm-square states from the theory. If you use Light Cone Gauge quantisation, 26 is the only spacetime dimension in which Lorentz Invariance is respected in bosonic string theory. Generally, you need a 26-dimensional spacetime to get rid of "conformal anomaly". Even if you are ready (which you shouldn't be) to accept negative-norm-square ghost states or the lack of Lorentz Invariance, you need a dimension of 26 to ensure that the different quantisation methods are consistent with one another in string theory.

On the other hand, Type II superstrings are only consistent in 10-dimensional spacetime, for similar reasons to the bosonic string. But you obviously can't have the left-movers living in 26-dimensional spacetime with the right-movers living in 10-dimensional spacetime!

The solution is to compactify the spacetime of the left-movers on a 16-dimensional lattice. This means that you make 16 of the dimensions of the left-movers' spacetime infinitesimally small. It happens to be (see notes) that this lattice needs to be even and unimodular. There are only 2 lattices that satisfy this. Namely, \(\frac{\operatorname{Spin}\left(32\right)}{\mathbb{Z}_2}\) and \(\left(E_8\right)^2\). The second is the cartesian product of an exceptional group with itself.

### Notes

For an explanation as to why the lattice must be unimodular and even, see this article and this answer.