In The Great Gatsby, Tom and Gatsby are foils who both want Daisy. Specifically, Tom is the antagonist of the novel, and Gatsby is the romantic (or Byronic) and tragic hero of the novel. So says Enotes:
Tom Buchanan is the villain of this novel and has Nazi-like theories of race. Nick knew him from Yale and describes him as “one of the most powerful ends that ever played football” there.
Gatsby commits himself to “the following of a grail” in his pursuit of her and what she represents. This obsession is characteristic of a dreamer like Gatsby, who loses a sense of reality but rather believes in “a promise that the rock of the world was founded securely on a fairy's wing.”
In terms of similarities, Tom and Gatsby are alazons (characters who think they are better than they really are). Tom is a womanizer, a brute, a racist, an elitist, an adulterer, a materialist, and a member of the bourgeoisie ("old money"). Gatsby, on the other hand, is a romantic dreamer, a kind of con artist, a bootlegger, a gambler/gangster, and a new member of the bourgeoisie ("new money"). Both courted Daisy before the war ended, but since Gatsby was poor, he lost the Southern debutante to the richer, more established Tom.
Both now live in Long Island, but Tom lives in the more chic East Egg (Gatsby is the West). Tom's desires are focused on money and women (Myrtle). Gatsby's desires are solely focused on Daisy. Both lead a double life: Tom has a mistress, while Gatsby has a mysterious past.
In terms of differences, Gatsby is a veteran of the Great War, while Tom is not. Tom is a father, and Gatsby is not. Tom has inherited his money, while Gatsby has had to amass his fortune himself (albeit through illegitimate means). Tom is an Ivy-Leaguer--Yale man (like Nick), while Gatsby only "went to Oxford" after the armistice.
Daisy decides to stay with Tom because he can better protect her with his money. Remember, she has committed a "hit and run" vehicular manslaughter, and Tom's reputation and "Good ole boy network" can best keep her safe. Gatsby, on the other hand, is a gangster who is about to be exposed by Tom and could not keep Daisy protected for long. In the end, Daisy runs away with Tom instead of Gatsby, hiding behind their money. She forsakes love for materialism--a major theme of the novel.