The time-dependent wave packet quantum dynamics studies for the Mg + (3p) + HD → MgH + /MgD + + D/H diabatic reaction are carried out for the first time on recently developed diabatic YHWCH potential energy surfaces [Phys. Chem. Chem. Phys., 2018, 20, 6638-6647]. The results of reaction probabilities and total integral cross sections show a dramatic preference to the formation of MgD + over MgH + owing to the insertion reaction mechanism in the title reaction. The MgD + /MgH + branching ratio witnesses a monotonic decrease from 10.58 to 3.88 at collision energy range of 0.01 to 0.20 eV, and at the collision energy of 0.114 eV, it is close to the experimental value of 5. The rovibrational state-resolved ICSs of the two channels show the products MgD + have higher vibrational excitation and hotter rotational state distributions. The opacity function P(J) suggests that the MgH + + D channel and MgD + + H channel are dominated by high-b and low-b collisions, respectively. Both forward and backward scattering peaks are found in the differential cross section curves, whereas the angle distributions of products are not strictly forward-backward symmetric because of the short lifetime of the complex in the reaction. Isotope effects play a key role in numerous chemical physics studies, which can shed more light on the study of reaction dynamics. Among the isotopic substitution reactions, the simplest type of A + HD has been the focus of sophisticated investigation by comparing different isotope branches 1-10. In particular, there are keen interests in the reactions of alkaline earth metal ions (X +) with HD molecules due to the strong preference of a certain isotope branching 11-13. Moreover, the interactions of alkaline earth metal ions with hydrogen molecule and its isotopic variants have received substantial investigations both experimentally and theoretically because of the importance in the field of cold and ultracold chemistry. On the experimental side, the reactions of laser-cooled alkaline earth metal ions, such as Be + , Mg + and Ca + , with hydrogen and its isotopic counterparts were performed in ion trap apparatus, and the cooled ions can be used as coolant to sympathetically cool the products of molecular ions 14-18. In theory, these reactions are also favorite objects to study cold and ultracold reaction dynamics. The collisions of Mg + ion with hydrogen molecule and its isotopic variants have received great attention experimentally in the past. Compared with the ground state Mg + ion, the reactions with electronically excited Mg + ion are of particular interest and complex because of the diabatic processes in the reactions. In 2000, Molhave et al. 19 produced the molecular ions MgH + (MgD +) in a linear Paul trap by the photochemical reactions of Mg + (3p 2 P 3/2) + H 2 (D 2) and the molecular ions were cooled sympathetically by Coulomb interaction with laser-cooled Mg + ions. These cold molecular ions are very valuable for many chemical physics contexts. In 2008, Staanum et al. 13 studied the single ion rea...