There was no oxygen when the Earth formed. Hydrogen and helium were the two gases that made up the Earth's early atmosphere. These elements have very small masses. Because of this, they escaped into space. Earth's gravity was not strong enough to hold onto them.
So, how was our atmosphere formed? You have learned that when a volcano erupts, huge amounts of gases escape. This is called outgassing. Much of this gas is water vapor. Carbon dioxide, methane, and ammonia are also released from volcanoes. Many scientists think the process of outgassing is what formed our early atmosphere.
As you can see, the Earth's early atmosphere still lacked oxygen. Volcanoes do not usually give off oxygen. So where did our oxygen come from?