In chapter 6 of The Great Gatsby by F. Scott Fitzgerald, Nick tells the reader Gatsby's origin story: that his real name is James Gatz, and he grew up very poor. One summer he meets Dan Cody, a fifty-year-old millionaire. Dan Cody becomes a mentor to Gatsby and hires him, and the two sail together for five years. Nick tells the reader:
It might have lasted indefinitely except for the fact that Ella Kaye came on board one night in Boston and a week later Dan Cody inhospitably died.
Gatsby worked for Cody in many capacities, as a "steward, mate, skipper, secretary, and even jailor" who cared for Cody when he was drunk. The two were friends, and Cody left money to Gatsby. However,
He didn't get it. He never understood the legal device that was used against him, but what remained of the millions went intact to Ella Kaye.
Ella Kaye, Dan Cody's mistress, inherited the fortune instead of Gatsby. Why, exactly? Well, Fitzgerald leaves us with a few clues. The first has to do with Ella Kaye's character. In the detail that Cody dies a week after she boards the yacht, it is implied that she might have something to do with his death. Fitzgerald also tells us that women like Ella Kaye pursued Cody simply for his money:
The transactions in Montana copper that made him many times a millionaire found him physically robust but on the verge of soft-mindedness, and, suspecting this, an infinite number of women tried to separate him from his money. The none too savory ramifications by which Ella Kaye, the newspaper woman, played Madame de Maintenon to his weakness and sent him to sea in a yacht, were common knowledge to the turgid sub-journalism of 1902.
Ella Kaye is a shady character who has a plan in place to take Cody's money, and so Gatsby is unable to claim it.
We can also infer that Gatsby was unable to fight for the money due to his status in life. Gatsby didn't understand "the legal device" that led to Ella Kaye receiving the money, and we know that Gatsby would not have been able to afford a lawyer to fight for his right to the money.