It is all down to an enzyme called
polyphenol oxidase.
Polyphenol Oxidase Activity and Colour Changes of «Starking» Apple Cubes Coated with Alginate and Dehydrated with Air
Their most efficient prototype relied on composite graphite discs loaded with the enzymes glucose oxidase and
polyphenol oxidase.
Plant defenses against chewing insects follow a jasmonite - mediated pathway that induces protease inhibitors and
polyphenol oxidase, which suppress digestion and growth.
This releases a chemical called
a polyphenol oxidase, an enzyme that pulls oxygen from the air and uses it to create compounds called o - quinones, which then link up into long chains (which may include proteins, too) that turn the apple's flesh brown.