To my knowledge (as a native speaker) there is no single word that can convey this idea. Not that we can't describe it, just that we need more than one word to do so.
You are closest with waving– it's just that you need to further describe how you are waving your hands, or where you are waving them.
“I started waving my hands in front of my nose when he began smoking near me1.”
“I started waving away the stench/smoke2 when he began smoking near me.”
1: Note that I removed "because of the smoke" for being excessively redundant.
2: "stench" is highly preferred in this specific sentence, because "smoke" would be redundant, but "waving away the smoke" is a good generic phrase if you are not also specifying that someone starting smoking. You could use "I waved away the smoke as I entered the bar" for instance.
In this sentence above, if you don't specify the location of the wave, or the purpose of the wave, it could easily be misinterpreted as "waving hello" instead of the intended gesture.
In your second sentence you are already halfway there– you included the purpose, but used the incorrect word "swing" instead of the correct "wave".
“He noticed that I knew he farted because I started to wave my hands to drive the smell away.”
Swing is incorrect because this verb doesn't actually include the back and forth motion, but rather simply the act of movement being tethered to a rotational point, and not making a complete circuit. Sorry, that's a complicated way to explain that "A single swing only goes in one direction". For example, if I "swing my fist at your face" it describes a single punch, without describing pulling back afterwards.
To use "swing" to describe an oscillation motion requires you to modify it to the continuous tense "swinging", or to use additional words to specify the oscillation: "swing back and forth". However, even this tense is not correct for the motion you want to describe, because the continuous "swinging" verb conveys the idea that the swinging is not powered by anything. If you drop a weight on a string, it will swing back and forth, but eventually slow down and stop because it isn't being propelled.