The metallic helimagnet MnSi has been found to exhibit skyrmionic spin textures when subjected to magnetic fields at low temperatures. The Dzyaloshinskii-Moriya (DM) interaction plays a key role in stabilizing the skyrmion state. With the help of first-principles calculations, crystal field theory and a tight-binding model we study the electronic structure and the origin of the DM interaction in the B20 phase of MnSi. The strength of D parameter is determined by the magnitude of the spin-orbit interaction and the degree of orbital mixing, induced by the symmetry-breaking distortions in the B20 phase. Our calculations suggest strong coupling between Mn-d and Si-p states, which is consistent with a mixed valence ground state |d 7−x p 2+x configuration. Consistent with previous calculations, we find that DFT+U leads to the experimental magnetic moment of 0.4 µB, which redistributes electrons between the majority and minority spin channels. We derive the magnetic interaction parameters J and D for Mn-Si-Mn superexchange paths using Moriya's theory assuming the interaction to be mediated by eg electrons near the Fermi level. Using parameters from our calculations, we get reasonable agreement with the observations.