  Production of axionlike particles (ALPs) by primordial magnetic fields may
have significant impacts on cosmology. We discuss the production of ALPs in the
presence of the primordial magnetic fields. We find a region of the ALP mass
and photon coupling which realizes the observed properties of the dark matter
with appropriate initial conditions for the magnetic fields. This region may be
interesting in light of recent indications for the 3.5 keV lines from galaxy
clusters. For a small axion mass, a region of previously allowed parameter
spaces is excluded by overproduction of ALPs as a hot/warm dark matter
component. Since the abundance of ALPs strongly depends on the initial
conditions of primordial magnetic fields, our results provide implications for
scenarios of magnetogenesis.
