What was Fitzgerald's purpose for writing The Great Gatsby?
Ultimately, we cannot determine the answer to this as it would require being able to see inside the mind of Fitzgerald and assess his inner feelings and motives, something that is not possible.
We do know that Fitzgerald, starting as a teenager, longed for literary success, wanting both to create great works and to become well-known and well-respected. Part of this may have stemmed from his family background, which existed at the fringes of the elite society of Minneapolis; as a student a Princeton Fitzgerald also found himself on the margins of an east coast elite. He was strongly ambivalent about the elites he both wished to join and despised for their insularity, materialism, and self-centeredness. Thus to some degree we can assume that among Fitzgerald's motives was a desire to work out some of his own ambivalence to upper class society.
Finally, Fitzgerald was a professional writer who was attempting to earn a living by writing and who was motivated in part to write because it was how he supported himself and his wife Zelda.