Sulfur hexafluoride decompositions have been studied to analyze their adsorption properties on pristine graphene (PG) and Mg-doped graphene (MgG). First of all, after calculating the formation energy of three Mg doping sites, the T doping site of Mg-doped graphene is the most stable one. Then, several characteristic structures with different orientations and positions of the gas molecules have been used to adsorb on PG and MgG, respectively. By calculating the adsorption energies and distance, the most stable adsorption structure of each gas molecule is obtained. In addition, charge transfer (Qt), the density of states (DOS) distribution, the energy of highest occupied molecular orbital (HOMO) and lowest unoccupied molecular orbital (LUMO) were used to further analyze the conductivity change and chemical stability of each adsorption system. The results indicate that the adsorption interactions of H2S, SO2, SOF2 and SO2F2 on PG are weak. H2S adsorbed on MgG presented physical adsorption, while the adsorption behaviors of SO2, SOF2 and SO2F2 on MgG are chemisorption. And the adsorption strength was SO2F2 > SOF2 > SO2. In short, MgG shows better selectivity and higher sensitivity to SO2, SOF2 and SO2F2 than PG, demonstrating that the MgG material can be used as suitable gas sensing equipment based on SF6 decomposition products detection, which provides a meaningful guide of alkaline earth metal doped graphene in the detection of partial discharge and partial overheat in gas-insulated switchgears (GIS).