Vitamin B12 is a group of biologically active cobalamin compounds. In this study, we investigated the inhibitory effects of methylcobalamin (MeCbl) and hydroxocobalamin acetate (OHCbl Acetate) on protein tyrosine phosphatase 1B (PTP1B). MeCbl and OHCbl Acetate exhibited an IC50 of approximately 58.390 ± 2.811 μM and 8.998 ± 0.587 μM, respectively. The Ki values of MeCbl and OHCbl Acetate were 25.01 μM and 4.04 μM respectively. To elucidate the inhibition mechanism, we conducted a 500 ns Gaussian accelerated molecular dynamics (GaMD) simulation. Utilizing PCA and tICA, we constructed Markov state models (MSM) to examine secondary structure changes during motion. Our findings revealed that the α-helix at residues 37-42 remained the most stable in the PTP1B-OHCbl Acetate system. Furthermore, upon binding of OHCbl Acetate or MeCbl, the WPD loop of PTP1B moved inward to the active pocket, forming a closed conformation and potentially obstructs substrate entry. Protein-ligand interaction analysis and MM-PBSA showed that OHCbl Acetate exhibited lower binding free energy and engaged in more residue interactions with PTP1B. In summary, our study confirmed the substantial inhibitory activity of OHCbl Acetate against PTP1B, with its inhibitory potency notably surpassing that of MeCbl. We demonstrated potential molecular mechanisms of OHCbl Acetate inhibiting PTP1B.