The foam drainage technique is considered to be a promising measure for solving the problem of liquid accumulation in natural gas wells and gathering pipelines. However, differences in gases can greatly affect the performance of surfactant foam, thus limiting the application of this technology. To elucidate the mechanism of natural gas components influencing foam properties, the interfacial properties of hydrocarbon gas-surfactant-water system were analyzed thermodynamically and kinetically by combining molecular dynamics simulations and foaming experiments. The results show that with the increasing alkane chain length, the foaming volume and half-life of the foam are gradually rising, while the gas–liquid interfacial tension is decreasing, which is consistent with the results of molecular dynamics simulations. Compared with air, hydrocarbon gases are more beneficial for foam generation and stabilization. The interfacial adsorption of alkane molecules and the interaction between alkanes and surfactants are the main factors affecting the interfacial tension and film stability of different systems.