The polarization switching in nanoscale with an anisotropic 2D magnetic semiconductor