When he first takes Nick to lunch, he tells him a little about his past, just the same vague stories that have kept everyone else guessing. He does this because, following his 'secret' conversation with Jordan Baker at the first party Nick attends, he learns that Daisy is Nick's cousin and he wants to set up a meeting.
In Chapter 8, Gatsby spills everything because Myrtle Wilson's death and Tom Buchanan's investigation had, or soon would, definitively end his role as Jay Gatsby:
"It was this night that he told me the strange story of his youth with Dan Cody-told it to me because "Jay Gatsby" had broken up like glass against Tom's hard malice, and the long secret extravaganza was played out" (131).
Although Daisy was driving, Gatsby (Gatz) was not giving that up; and he may have thought that Tom would rat him out to Wilson. In any case, he'd stopped having parties, and by this time, he was broke. With the upcoming publicity/rumors, his drug/bootlegging business was done and Wolfsheim broke off ties with him because it was bad for business. The car accident also, more importantly, forever scarred his hope of reliving the past (as a new future) with Daisy. So, he had nothing left; not even the green light across the sound. After he met Daisy again, he didn't need the iconic light. "His count of enchanted objects diminished by one" (84 - Ch. 5). So, he tells Nick everything because he's lost everything.