In the Periodic Table, the symbol of oxygen is "O". Usually, the symbol "O" represents an atom of oxygen.
O2 is the chemical formula of oxygen molecule or oxygen gas (since oxygen gas contains a huge number of oxygen molecules). Oxygen molecule are diatomic. In other words, each oxygen molecule contains 2 oxygen atoms. The diagram of an oxygen molecule is shown in the following link: http://www.nyu.edu/pages/mathmol/textbook/oxygen.gif
Since each oxygen molecule contains two oxygen atoms, the formula of an oxygen molecule O2. The subscribe “2” represents the number of atoms in the molecule.