In this talk I will discuss the origins of magnetic exchange interactions in the underlying electronic structure from a first-principles point of view. I will start from the textbook examples of the Heisenberg Hamiltonian, the Stoner theory of itinerant magnetism and various indirect exchange couplings. I then pose the question of how these various behaviors should emerge naturally from a first-principles calculation of the electronic structure. I will present the disordered local moment picture that emerges from spin-density functional theory and how it is based on an adiabatic decoupling of slow and fast degrees of freedom. I will discuss how non-collinear magnetism and the linear response calculation of exchange interactions are naturally obtained in the framework of multiple scattering theories of electonic structure. Finally, I will go through two cases studies of my own work to illustrate these concepts: Mn-doped ScN and rare-earth nitrides.