Apples contain an enzyme polyphenol oxidase or tyrosinase that reacts with oxygen to forms a sort of rust on the surface of the fruit. When the fruit is cut or bruised, cells of the fruit get damaged which result in the release of the enzyme. Now the enzyme is available to react with oxygen and form a sort of rust on the surface of fruit.