According to a source the answer is Cyanobacteria were the first organisms to produce oxygen in water, which then escaped into the atmosphere.
These cyanobacteria species were the first ones to "produce" oxygen as a by-product of the photosynthetic mechanisms which enables organisms to make their own food.