The metal exchange reaction has emerged as an efficient method to synthesize ligand-protected alloy nanoclusters with precise compositions and structure. However, the understanding of the mechanism of these metal exchange processes is quite limited. Herein, the dynamic process of metal exchange of Au25(SR)18- and Ag25(SR)18- (R = CH3) nanoclusters with metal ions (Au+, Ag+, Cu2+, Cu+, Cd2+, and Hg2+) is investigated using ab initio molecular dynamics simulations. Computational results unveiled a multifaceted nature of the metal exchange process, dictated by several variables, including thermodynamic stability, electrochemical activity, metal affinity to ligand, and the coordination mode of metal ions. As a result of these factors, metal ions may either directly exchange with Au or Ag atoms on the icosahedral core surface by a "knock-off" mechanism or be stably adsorbed at the core-motif interface of Au25(SR)18- and Ag25(SR)18- nanoclusters. Meanwhile, we also discovered that counterions can promote adsorbed Ag and Cu atoms to diffuse into the gold core. Finally, the driving force of the galvanic reduction and antigalvanic reduction reactions is discussed. The formation of a more stable core-doping product nanocluster is the major driving force of metal exchange reactions.