In his plea agreement, Flynn admitted he lied to FBI agents about two discussions he had with Sergey Kislyak, the Russian ambassador to the United States, in December 2016 when Flynn was still a private citizen and before Trump took office.
Flynn was never asked if had discussions with Kislyak, the FBI asked Flynn if had any prior policy conversations with foreign nationals, he said NO. The FBI went back and listened to the calls with Kislyak and concluded Flynn hadn't lied, the calls were about congratulations for Trump's win and who contacts would be once Trump was sworn in. The Agent handling the investigation concluded he didn't lie since he wasn't asked if he had ever talked to a foreign nationals. Comey decided to go ahead pursue charges anyway.
After he had exhausted his life savings and had to sell his home for defense costs, the FBI pointed out they would be opening investigations but not conduct those investigations if he pled guilty to lying since he should have brought up the calls to Kislyak during the questioning. They also pointed out they wouldn't ask for jail time if he pled guilty. Flynn knew the threat to investigate his son, meant they would destroy his son's life as they did his, so Flynn pled guilty to lying.
Once Flynn pled guilty, the VP had no choice but to replace Flynn. The twist when the DOJ changed the terms of their agreement with Flynn and said that if he could give dirt on Trump, they wouldn't pursue any jail time. Flynn told them he didn't have any dirt on Trump, so the DOJ decided that since he had pled guilty they were going to make an example out of him for the cooperating with them on getting Trump. They went for the max, that's when Flynn said he was withdrawing his guilty plea.