Advances in helioseismology provide new knowledge about the origin of solar magnetic activity. The key questions addressed by helioseismology are: what is the physical mechanism of the solar dynamo, how deep inside the Sun are the magnetic fields generated, how are they transported to the surface and form sunspots? Direct helioseismic signatures of the internal magnetic fields are weak and difficult to detect. Therefore, most of the information comes from observations of dynamical effects caused by the magnetic fields. I review results of recent helioseismic observations of the magnetohydrodynamics of the solar interior on various scales, including global dynamics associated with the dynamo processes, and formation of sunspots and active regions.