Both work by oxidation. Think of oxidation as controlled burning. It's a harsh process. Bleaches should be treated with some respect and used properly. Chlorine bleach is, paradoxically, a much stronger oxidizer than oxygen bleach.
Oxygen bleaches are color safe, and are marketed as such.
Some laundry detergents contain an oxygen bleach. I find them useless because of their weakness. When a garment tag instructs not to bleach, that means chlorine bleach. Oxygen bleach is safe to use. Chlorine bleach is a strong oxidizer.