While Gatsby -- yet to change his name and still going by James Gatz -- is still young and unsure of his direction in life, he meets an old millionaire named Dan Cody. His first impression is favorable; Cody's yacht is a symbol of the man's wealth and helps to ignite Gatsby's obsession with wealth and social status.
To the young Gatz, resting on his oars and looking up at the railed deck, the yacht represented all the beauty and glamour in the world.
He was employed in a vague personal capacity—while he remained with Cody he was in turn steward, mate, skipper, secretary, and even jailor, for Dan Cody sober knew what lavish doings Dan Cody drunk might soon be about, and he provided for such contingencies by reposing more and more trust in Gatsby.
(Fitzgerald, The Great Gatsby, mrbye.com)
Gatsby learns social lessons from Cody, as well as beginning his understanding of alcohol and its effects on people; he also learns how much money a person can make by selling it, a practice which becomes illegal. Cody's lifestyle and reputation appeals to Gatsby even as Cody's habits and the people around him repulse Gatsby, and he starts his journey to personal wealth. The ability to buy and sell anything he wants is a crucial part of Gatsby's eventual public persona. Finally, Cody's death -- which may have been murder -- gives Gatsby his first taste of real wealth, an inheritance which allows Cody's paramour to inherit the rest of the money. The lessons Gatsby learns from living with Cody stay with him, and help to create the persona of Jay Gatsby.
We are given the answer to this question in Chapter Six of this excellent novel. This chapter begins with some more background information about Gatsby and in particular what the point was which set him on the course to leaving his identity as James Gatz behind him. Dan Cody, we are told had been made "many times a millionaire" thanks to his involvement in "every rush of metal since seventy-five." However, his weakness for women and the way that they tried to separate him from his money was a big problem for him. Note the way that the text comments on how Dan Cody presented Gatsby with an opportunity to remake himself and set himself on his path to riches and glory:
[Gatsby] had changed [his name] at the age of seventees and at the specific moment that witnessed the beginning of his career--when he saw Dan Cody's yacht drop anchor over the most insidious flat on Lake Superior. It was james Gatz who had been loafing along the beach that afternoon in a torn green jersey and a pair of canvas pants, but it was already Jay Gatsby who borrowed a rowboat, pulled out to the Tuolomee, and informed cody that a wind might catch him and break him up in half an hour.
Dan Cody is therefore an incredibly important character in terms of the making of the Jay Gatsby that we see in the novel. It was the chance of helping Dan Cody that gave him the opportunity to be useful to him, which resulted in his involvement in upper class life.
Dan Cody is a millionaire who is sailing in his boat and meets up with James Gatz(soon to be Jay Gatsby). He takes on the charming young and allows him to travel about with him and learn about the life of a wealthy man. His purpose in the novel, even though the reader never really meets him because he is dead, is to help Gatsby metamorphise into the person he is today rather than the poor young man he was in his past.