In the interaction between gas molecules with single-walled carbon nanotube (SWCNT) we show that as a result of collisions the gas scattering contributes with an important background signal and should be considered in SWCNT-based gas sensors. Experimental evidence of the collision-induced tube wall deformation is demonstrated using in situ X-ray absorption near-edge structure spectroscopy. Results support the occurrence of the scattering process and show how gas collisions may affect the electronic structure of SWCNTs.