Using a first-principles approach, we analyze the impact of DX centers formed by S, Se, and Te dopant atoms on the thermal conductivity of GaAs. Our results are in good agreement with experiments and unveil the physics behind the drastically different effect of each kind of defect. We establish a causal chain linking the electronic structure of the dopants to the thermal conductivity of the bulk solid, a macroscopic transport coefficient. Specifically, the presence of lone pairs leads to the formation of structurally asymmetric DX centers that cause resonant scattering of incident phonons. The effect of such resonances is magnified when they affect the part of the spectrum most relevant for thermal transport. We show that, in the vibrational spectrum of the perturbed system, they take the form of modes that are localized around the defect but still extended enough to couple with incident phonons. Finally, we illustrate the connection between flat adjacent minima in the energy landscape and resonant phonon scattering through detailed analyses of the energy landscape of the defective structures.