This study has investigated the adsorption of phosphine toxic gas molecule on monolayer graphene, bilayer graphene and twisted bilayer graphene with, and without Magnesium impurity. The results of absorption energy studies using density functional theory (DFT) showed that bilayer graphene provides better adsorption than monolayer graphene and a difference in adsorption energy will be observed for twisted bilayer graphene with a rotation angle of 21.78°. By adding Mg impurity to the configurations, the sensitivity, and working temperature of the twisted bilayer graphene with Mg impurity increase compared to twisted bilayer graphene. Also, working temperature, and value of adsorption energy were calculated for bilayer graphene with Mg impurity less than Mg-doped twisted bilayer graphene, and monolayer graphene with Mg impurity.