H-2 is one of the main fault characteristic gases dissolved in transformer oil, which can indicate the electric faults, such as high energy discharge, spark discharge and partial discharge, and partial oil overheating phenomenon. Detection the content of H-2 has an important significance for transformer diagnosis and state assessment. Gas sensing detection technology is the core of online monitoring device. In this paper, for the detection of dissolved H-2, based on the density functional theory and the first-principles, pure and Ag-doped SnO2 models and gas adsorption models were built, and theoretical calculations were conducted. Meanwhile, pure and Ag-doped SnO2 gas sensing materials were synthesized with hydrothermal method. Then SnO2 based gas sensors were fabricated and their gas sensing properties were measured. Finally, its gas sensing mechanism was discussed based on the macro gas sensing properties and micro simulating calculations. The results indicated that, Ag doping can improve the gas sensing properties of SnO2 nanostructures to H-2, Ag doping sensor has better effect than pure sensor for H-2 detection, such as a lower optimum operating temperature of 340 degrees C, lower detection limit of 10 mu L/L with higher sensitivity. The role of the dopant of Ag into the SnO2 and the sensing mechanism had also been discussed in this work. The experimental results verifies the feasibility and accuracy of study the gas sensing performances of SnO2 based gas sensors using the first-principles calculation based on the density functional theory, further perfecting its gas sensing mechanism of SnO2 based gas sensor and providing us a fresh idea and feasible way to develop different kinds dopant of metal or metal-oxide gas sensors with high performances.