But Krasnodar winger Claesson, a second-half substitute, held his nerve to slot home Sweden's third in the fourth minute of added time.
Sweden will now play Ukraine, Czech Republic or Switzerland in Glasgow on Tuesday in the round of 16, while Group E rivals Spain face Croatia in Copenhagen on Monday following their 5-0 win against Slovakia.
Sweden, who have progressed from their group at a Euro finals for the first time since reaching the quarter-finals in 2004, extended their unbeaten run in 2021 to eight matches.
They made a flying start, scoring from their first attack. Forsberg burst onto the ball after team-mate Alexander Isak had been tackled on the edge of the area and drilled an emphatic finish into the bottom corner.
Poland should have equalised in the 18th minute when Lewandowski, who scored a Bundesliga record of 41 goals this season, somehow missed after having two bites of the cherry.
The Bayern Munich striker headed Piotr Zielinski's corner against the underside of the crossbar and after the ball bounced back to him, his second header also struck the crossbar before Sweden hacked it clear.
Poland began to get a foothold in the game and breached the Swedes' yellow defensive wall just before half-time.
Napoli midfielder Zielinski combined well with Lewandowski and arrowed a shot towards the top corner, which was brilliantly saved by Sweden goalkeeper Robin Olsen.
Poland were left a mountain to climb in the 59th minute when Forsberg struck his second for Sweden, first time from just inside the area, following a swift counter-attack.
But Poland hit back within two minutes through Lewandowski, who cut inside and curled a superb right-footed finish beyond Olsen.
A lengthy VAR check then denied Poland an equaliser for offside after Jakub Swierczok had tapped home from close range.
With time running out for Poland, impressive substitute Przemyslaw Frankowski's cross picked out Lewandowski, who controlled and calmly slotted home to set up a grandstand finale.
It was Lewandowski's 69th international goal in 122 appearances, but Claesson ended Poland's hopes in added time after being set up by Dejan Kulusevski.