Going a bit further … in baseball a whiff is a clean miss. Unlike a foul tip where contact is made. In a non-baseball context “a whiff” is a failure that doesn’t even deserve partial credit. IOW, an especially ineffective failure at doing whatever was expected.
I heard the term “whiff” in golf, with the same context - swing and completely miss. Whiff sound more obvious in golf, but probably Gorsnak is right, it entered the popular language from baseball with a wider audience across the country for a longer time.