The polymorphism of two-dimensional (2D) transition-metal dichalcogenides (TMDs) and different electronic properties of the polymorphs make TMDs particularly promising materials in the context of applications in electronics. Recently, local transformations from the semiconducting trigonal prismatic H phase to the metallic octahedral T phase in 2D MoS2 have been induced by electron irradiation [ Nat. Nanotech. 2014, 9, 391 ], but the mechanism of the transformations remains elusive. Using density functional theory calculations, we study the energetics of the stable and metastable phases of 2D MoS2 when additional charge, mechanical strain, and vacancies are present. We also investigate the role of finite temperatures, which appear to be critical for the transformations. On the basis of the results of our calculations, we propose an explanation for the beam-induced transformations, which are likely promoted by charge redistribution in the monolayer due to electronic excitations combined with formation of vacancies under electron beam and buildup of the associated mechanical strain in the sample. As this mechanism should be relevant to other 2D TMDs, our results provide hints for further development and optimization of electron-beam-mediated engineering of the atomic structure and electronic properties of 2D TMDs with subnanometer resolution.