It originates from Greek mythology, specifically the story of the Trojan War. In this story, the goddess Eris, goddess of discord, threw a golden apple into a wedding feast, inscribed with the words "For the Fairest." This caused a dispute between Hera, Athena, and Aphrodite, each claiming to be the most beautiful. The conflict over the apple ultimately led to the Trojan War.
Therefore, the idiom "apple of discord" signifies a source of contention or argument, something that sparks a disagreement or fight.