The structures and intramolecular interactions of complexes (FeCNT-CO, FeCNT-NO, NiCNT-CO, and NiCNT-NO) formed by the Fe or Ni doped single-wall carbon nanotube (FeCNT or NiCNT) and gas CO or NO were studied using density functional theory, quantum theory of atom in molecule (QTAIM), and natural bond orbital methods. The adsorption processes of CO and NO on surfaces of FeCNT and NiCNT are chemisorption, energetically favored, exothermic, and spontaneous. High temperature is not good for adsorption. Introducing NO more obviously elongates the distances between Fe/Ni and C atoms and decreases ∠CFe(Ni)C than adding CO. QTAIM analysis shows that the covalent bonding interactions of FeCNT-NO (NiCNT-NO) are stronger than that of FeCNT-CO (NiCNT-CO). NO plays a role of electron acceptor while CO is electron donator in complexes. Electrostatic interaction of FeCNT-NO (NiCNT-NO) is stronger than that of FeCNT-CO (NiCNT-CO). The stronger intramolecular interactions of FeCNT-NO and NiCNT-NO reveal that FeCNT and NiCNT are more effective to adsorb and sense NO than CO. CO and NO considerably change the electronic properties of FeCNT and NiCNT, which is useful for designing sensors for CO and NO.