Magnesium alloys, being the lightest structural metals, have garnered significant attention in various fields. The characterization of inelastic behavior has been extensively investigated by researchers due to its impact on structural component performance. However, the occurrence of twinning in the absence of any applied driving force during unloading has lacked reasonable explanations. Moreover, the influence of deformation mechanisms other than twinning on inelastic behavior remains unclear. In this study, uniaxial tension and compression tests were conducted on hot-rolled magnesium alloy plates, and neutron diffraction experiments were employed to characterize the evolution of macroscopic mechanical response and microscopic mechanisms. Additionally, a twinning and detwinning (TDT) model based on the elastic visco-plastic self-consistent (EVPSC) model has been proposed, incorporating back stress to describe the deformation behavior during stress relaxation. This approach provides a comprehensive understanding of the inelastic behavior of magnesium alloys from multiple perspectives and captures the influence of microscale mechanisms. A thorough understanding of the inelastic behavior of magnesium alloys and a reasonable explanation for the occurrence of twinning under zero-stress conditions offer valuable insights for the precise design of magnesium alloy structures.