Following Paris St Germain's 2-0 over Seattle Sounders in Monday's other Group B game, the French side finished level on six points with Botafogo and Atletico.
However, European champions PSG secured top spot thanks to a superior goal difference, with South American champions Botafogo also advancing to the last 16 after finishing second.
Atletico, in third, and Seattle, bottom with no points after three games, were eliminated.
PSG will face the Group A runners-up on Sunday, while Brazil's Botafogo will take on the Group A winners on Saturday.
Even though they were aware that a two-goal defeat would secure them a place in the next round, Botafogo's Igor Jesus and Jefferson Savarino forced Atletico keeper Jan Oblak to make a couple of brilliant saves.
Following their shock 1-0 win over Champions League winners PSG, Botafogo defended their ground fairly well throughout a cagey encounter, with Atletico dominating possession but rarely presenting a real threat to goalkeeper John.
However, tempers spilled over when Atletico appealed for a penalty after Botafogo's Gregory appeared to step on Julian Alvarez's foot inside the box.
Following a VAR review, referee Cesar Ramos ruled out the penalty due to an earlier foul by Atletico's Alexander Sorloth in the build-up.
The decision left Atletico manager Diego Simeone furious, with the Argentine storming onto the pitch at halftime to confront the Mexican official.
As Atletico made a late run desperately looking for the three goals they needed, substitute Griezmann fired the winner in the 87th minute from inside the box, a bittersweet goal that denied Botafogo a top-placed finish in the group and handing PSG that accolade.
In Seattle, Khvicha Kvaratskhelia scored in the first half, Achraf Hakimi struck in the second as Paris Saint-Germain secured their place in the last 16 with their victory over the hosts.