An electricity generating method comprises storing a compressed gas in an underground cavity, taking out a compressed mixed gas containing the compressed gas from an underground gasification cavity, sending the compressed mixed gas into a combustion chamber, and/or sending the compressed mixed gas to an underground gasification furnace for generating a combustion gas and sending to the combustion chamber. An electricity generating system comprises a compressor with an gas exhaust opening, an underground gasification furnace with a gas inlet well and a gas outlet well, a gas turbine, a combustion chamber, and an underground gasification cavity with a storage gas inlet and a storage gas outlet; or, the gas exhaust opening is communicated with the storage gas inlet, the storage gas outlet is communicated with the combustion chamber and the gas inlet well, and the gas outlet well is communicated with the combustion chamber; or, the gas exhaust opening is communicated with the storage gas inlet and the gas inlet well, the storage gas outlet is communicated with the combustion chamber, and the gas outlet well is communicated with the combustions chamber; or, the gas exhaust opening is communicated with the storage gas inlet and the combustion chamber, the storage gas outlet is communicated with the gas inlet well, and the gas outlet well is communicated with the combustion chamber. The electricity generating method and the electricity generating system realize electricity generating, and also realize treatment on pollutants in the underground gasification cavity.