According to the Smithsonian Institution, the first gasmask ever was the brainchild of Oxford University scientist John Scott Haldane.
Haldane, who was horrified by the prolific usage of mustard and chlorine gas against Allied soldiers by the Germans in WWI, developed the life saving device which more than likely wouldn't have saved him personally, because of the huge, bushy moustache that he sported at the time.
Dr. Haldane, a medical researcher as opposed to a doctor, was born in Edenburg, Scotland in 1860 and then got his medical degree in 1884. He taught at many different universities, and his specialty was developing medical treatments for industrial ailments and accidents. Therefore, the effects of gas on human lungs and the protection of same was right up Dr. Haldane's alley. This is due to the fact that Haldane was also the scientist who originated the usage of canaries and other small animals in coal mines to detect colorless and odorless gasses. As a matter of fact he was an expert on respirators for miners and was therefore the natural go-to guy in regards to taking his technology a step further in the application of it towards chemical protection.
Here's a bit of colloquial information; prior to perfecting the technology needed to create the first gas mask, Haldane released a recommendation for defense against gas attacks... "Hold a urine soaked handkerchief or sock to your face", he wrote, "and breathe through that."