Hydrogen, as a clean energy source, has high calorific value, low pollution, and renewability. Injecting hydrogen into natural gas pipelines is efficient and economical for transportation. Unfortunately, flammable gas pipelines often leak due to material corrosion, construction defects, and external interference. To this end, a numerical method is established to investigate the gas diffusion behaviour and accumulation of leaked natural gas from an underground pipe to the soil. The variations in gas concentrations under different leak conditions, as well as the effects of pipeline release pressure orifice diameters (4.0–5.8 MPa), orifice diameters (1, 5, 10 mm), hydrogen-doped ratio (0–30%), and soil porosity (0.1–0.4) on the mass flow rate at the leakage point are evaluated. The simulation results indicated that the mass flow rate and gas concentration increase fast with release pressure. Leakage with high hydrogen content can lead to an opposite trend between methane and hydrogen concentration. The soil porosity directly determines the gas concentration distribution of diffusion at different monitoring points. Moreover, the quantitative relationship between the mass flow rate and different influencing factors has also been fitted. Finally, an empirical correlation formula is used to explain the leakage and diffusion characteristics of hydrogen-doped natural gas in soil.