In this paper, an analytical solution is obtained for the magnetoelastic response of a multilayered and functionally graded cylinder with an embedded dynamic polynomial eigenstrain. The internal core of the cylinder endures a harmonic eigenstrain of cubic polynomial distribution along the radial direction. Both plane strain and plane stress conditions are assumed for the axisymmetric cylinder. The composite cylinder is placed in a constant magnetic field parallel to its axis. The magnetoelastic governing equations are solved exactly and the displacement and stress components are obtained in terms of Bessel, Struve, and Lommel functions. Using the analytical solution for the multilayered, composite cylinder, the magnetoelastic response of a functionally graded cylinder with exponential and power law distribution of material properties is investigated. Finally, the numerical results reveal the effects of external magnetic field, eigenstrain, and nonhomogeneity indices on the magnetoelastic response of the heterogeneous cylinders.