We’re using an event as a foil to another event. Both are epic struggles, both are a ‘one-person-has-to-lose’ deal, and both involve the old man’s pride, his need to be El Campeon. What makes the arm-wrestling a foil is that it comments on the marlin issue in an interesting way; the old man was young and strong in Casablanca, but now he’s old and emaciated and alone.
OK, the sharks are a foil in the sense that they are NOT similar to the marlin. The marlin is "beautiful" and "noble," but the sharks that attack at the end of the fiasco are "hateful" and "scavengers." They are "stupid," not elegant. The feelings of dislike we have toward the shark are not the feelings of respect and reverence we (and the old man) have for the fish.