There are two senses in which exceptional groups arise in heterotic string compactification. First let us say a bit about heterotic string theory, which we will need below.
There are two heterotic string theories, forming two of the five superstring theories in ten dimensions. These two string theories have different fundamental symmetries, with one having an $E_8 \times E_8$ symmetry and the other an $SO(32)$ symmetry. The way this symmetry appears will be covered more below. (Here $E_8$ is one of the exceptional simple Lie groups, and $SO(32)$ is also a simple Lie group. The direct product $\times$ in $E_8 \times E_8$ just says that there are two distinct $E_8$ symmetries, which are independent.)
Heterotic string theory (either of the two distinct theories) is roughly like half of a bosonic string theory, which lives in 26 dimensions, paired with half of a supersymmetric string theory, which lives in 10 dimensions. (This precise way these two different theories are combined to give heterotic string theory is covered in any string theory textbook. The fact that the heterotic string theory is a sort of hybrid theory is the reason for the name 'heterotic'.)
First sense:
These two theories being combined live in different numbers of dimensions, and to combine these two theories the bosonic string theory is first compactified on a 16-dimensional torus $T^{16}$. The structure of string theory puts constraints on the structure of this torus, and these constraints lead to essentially two possible choices. (The possible tori are given by what are called the possible even, self-dual lattices in sixteen dimensions.) The two heterotic string theories correspond to these two different choices of compactification torus. Further, in each of the two heterotic string theories the symmetry ($E_8 \times E_8$ or $SO(32)$) arises as the symmetry group of this sixteen-dimensional torus $T^{16}$ (or the corresponding lattice).
Hence the compactification of the bosonic string theory, which was done in order to give a consistent way to combine it with a superstring theory and so form heterotic string theory, has given rise in the case of one of the heterotic string theories to a theory with an exceptional group (actually two of them, $E_8 \times E_8$) as a symmetry group. This is one sense in which heterotic string compactification gives rise to exceptional groups.
Second sense:
At low energies, each of the five superstring theories has an effective low-energy description given by a supergravity theory, and these supergravities are field theories. Depending on the superstring theory, this field theory has different field content. In particular, when we start with a heterotic string theory the field content of the low-energy theory includes gauge fields. In fact, there are $496=2\times248$ distinct vector fields in the low-energy theory, and the gauge group of these vector fields is precisely $E_8 \times E_8$ or $SO(32)$ in the cases of the two heterotic string theory. (The symmetry group of the string theory descends to a gauge symmetry of the low-energy field theory, i.e. the supergravity.)
Further, heterotic string theory lives in ten dimensions, and one classic way to try to make this theory consistent with the observed four dimensions is to compactify the other six. It turns out that it is consistent (or even necessary) to turn on some values of the above gauge fields in these compactified dimensions, while still remaining in a stable vacuum. In particular one can turn on values for the gauge fields but not the gauge field strength ('Wilson lines') or one can turn on the gauge field strengths themselves.
Turning on these gauge fields (in the compactified space) in the vacuum state spontaneously breaks the full gauge symmetry: gauge transformations no longer map us to the same state. For example, we can turn on gauge fields that live in one of the $E_8$ gauge groups of the $E_8 \times E_8$ heterotic string theory (really the supergravity). Depending on how we turn on the gauge fields, the symmetry can be broken to different remaining symmetry groups. (If we did not break the symmetry in any way, we would see the full $E_8 \times E_8$.)
It is common (at least as a first step) to leave one of the $E_8$ factors unbroken and to turn on gauge fields in the other $E_8$ factor. This $E_8$ factor can then be broken (by the presence of the non-zero gauge fields) to various possible remaining symmetries, including for example $SU(5)$, $SO(10)$, and $E_6$. Each of these are very interesting remaining symmetries, because they contain (and can be broken to, by further symmetry breaking) the gauge group $SU(3) \times SU(2) \times U(1)$ of the Standard Model (they are common GUT groups). $E_6$ was historically a widely pursued option, as it was seen as a promising GUT candidate.
Hence in compactification of the heterotic string theory from ten to four dimensions, gauge fields in the compactified space can be used to break the original gauge symmetry and give rise to remaining symmetry groups that are phenomenologically interesting GUT groups that can contain the Standard Model. Further $E_6$ has often been sought as the remaining symmetry group (as have other options). Hence this is another sense in which heterotic string compactification gives rise to exceptional groups.