The practice stems from an ancient Greek myth according to which the goddess of discord, Eris, was upset that she was not invited to the wedding of Peleus and Thetis. In revenge, she threw a golden apple inscribed with the words saying « to the most beautiful » in the wedding party.
Three goddesses; Hera, Athena and Aphrodite claimed the apple. Paris of Troy was then appointed to select the recipient. He was bribed by the three goddesses, but accepted that of Aphrodite who had promised him the most beautiful woman in the world, Helen of Sparta, indirectly causing the Trojan War.
Since then, the apple was considered sacred to Aphrodite, the goddess of love. Throwing an apple was the symbolic way of declaring love and catching it meant the reciprocal feeling.