Recent observations of active galactic nuclei (AGNs) have shown a high Fe II/Mg II line-flux ratio in their broad-line regions, nearly independent of redshift up to 𝑧 6. The high flux ratio requires rapid production of iron in galactic nuclei to reach an abundance ratio of [Fe/Mg] 0.2 as high as those observed in matured galaxies in the local universe. We propose a possible explanation of rapid iron enrichment in AGNs by massive star formation that follows a top-heavy initial mass function (IMF) with a power-law index of Γ larger than the canonical value of Γ = −2.35 for a Salpeter IMF. Taking into account metal production channels from different types of SNe, we find that the high value of [Fe/Mg] 0.2 requires the IMF to be characterized with Γ −1 (Γ 0) and a high-mass cutoff at 𝑀 max 100-150 M (𝑀 max 250 M ). Given the conditions, core-collapse SNe with 𝑀 * 70 M and pair-instability SNe give a major contribution for iron enrichment. Such top-heavy stellar IMFs would be a natural consequence from mass growth of stars formed in dense AGN disks under Bondi-like gas accretion that is regulated by feedback at 𝑀 * 10 M . The massive stellar population formed in AGN disks also leave stellar-mass black hole remnants, whose mergers associated with gravitational-wave emission account for at most 10 % of the merger rate inferred from LIGO/Virgo observations to simultaneously explain the high [Fe/Mg] ratio with metal ejection.