system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: How is that Earth has an atmosphere? What is fighting with the vacuum? Why is some gas able to create pressure out of nothing?
gpt
In a word, Gravity

The Earth's gravity pulls on the atmosphere the same way that it keeps the oceans glued to the earth.

At some point during the Earth's formation much of the Earth was liquid due to it's high temperature so the lighter gaseous elements like Hydrogen, Helium, Carbon Dioxide, and Nitrogen bubbled to the surface.

Much of this gas was lost to space but what remained formed our atmosphere.

Gravity is also what makes the atmosphere denser as you get closer to Earth's surface.