How did these apples grow together?
They are basically conjoined apples which share a common stalk. They are rare but do happen. Here is an article of one discovered in a backyard. 



conjoined apple discovered in a store (reference)

It apparently happens because of bad weather conditions, stress and insect damage. Fused fruits are also found in the case of cherries, watermelons, peaches etc.


  Inadequate pollination because of heat and other adverse growing
  conditions causes that section of the fruit in which the seed did not
  develop to not grow and fill out. Also, the fruit primordium
  (embryonic growing point) can be damaged or altered by environmental
  factors and cause strange growth forms. Of course, Siamese twins or
  two fruit growing together is also rather common(reference).


Read more about them on article 1 and article 2.