The original character for the meaning gas, atmosphere is 「气」, while using 「氣」 for this meaning is strictly a phonetic loan.
「氣」 (Baxter-Sagart OC: /*qʰ(r)ə[t]-s/) originally meant gifting food to someone, comprised from semantic
「米」 (rice) and phonetic 「气」 (/*C.qʰəp-s/). This word is now written as 「餼」.
「气」 was originally a picture of thin clouds.
商
甲

前7.36.2
合集12532
The stylisation that occurred to form the modern shape of 「气」 was firstly to differentiate the character from the similar-looking 「三」.
春秋
金

洹子孟姜壺
集成9730
篆

气部
說文解字秦
簡

法115
睡虎地秦簡
Later on, the character became used as a phonetic loan for a word /*C.qʰət/, to beg, request, and thus the meaning gas, atmosphere 「气」 started to be written differently from the meaning beg, request 「乞」.
「气」
東漢
隸

魯峻碑
楷

「乞」
東漢
隸

武梁祠畫象
楷

「氣」 was first created to represent the unrelated word now written as 「餼」. Probably, due to the potential confusion caused by 「气」 and 「乞」 being the same character,「氣」 became used as a phonetic loan for the word meaning gas, atmosphere, and eventually became the overwhelmingly preferred way of writing this word.
To write the word originally written as 「氣」, semantic 「食」 (food) was later added to form 「餼」.
References: