We study the partial decay widths of charmonium (bottomonium) states to $D\bar D (B\bar B)$ mesons in magnetized (nuclear) matter using a field theoretic model of composite hadrons with quark (and antiquark) constituents. These are computed from the mass modifications of the decaying and produced mesons, including the nucleon Dirac sea effects within a chiral effective model. The Dirac sea contributions are observed to lead to an rise (drop) in the quark condensates as the magnetic field is increased, an effect called the (inverse) magnetic catalysis. In the presence of a magnetic field, there are mixings of spin 0 (pseudoscalar) and spin 1 (vector) states (PV mixing) The nucleon Dirac sea effects are observed to be significant and the anomalous magnetic moments (AMMs) of the nucleons are observed to play an important role. For $\rho_B$=0, there is observed to be magnetic catalysis (MC) without and with AMMs, whereas, for $\rho_B=\rho_0$, the inverse magnetic catalysis (IMC) is observed when the AMMs are taken into account, contrary to MC, when the AMMs are ignored. The magnetic field effects on the heavy quarkonium decay widths should have observable consequences on the production of the hidden and open heavy flavour mesons from ultra-relativistic peripheral heavy ion collision experiments, at RHIC and LHC, where the produced magnetic fields are extremely large.