Milan needed to win to stand any chance of progressing to the last 16 and went in front through their England defender Fikayo Tomori in the first half to cheer the home support.
But Salah soon equalised with his 20th goal of the season in all competitions and Origi, who came on to score a stoppage-time winner against Wolverhampton Wanderers in the Premier League on Saturday, headed home Liverpool’s second after the break.
Juergen Klopp’s side became the first English team to enjoy a perfect Champions League group stage campaign, finishing top of Group B with 18 points.
It was also the first time in their history that they had chalked up a sixth consecutive victory in the competition.
"What the boys did tonight, I could not be more proud," Klopp told BT Sport. "The performance was outstanding. Having 21 shots, so many situations where we played outstandingly well and defended passionately and well organised."
Milan came last with four points in their first Champions League campaign since 2013-14,asAtletico Madrid beat Porto 3-1 to reach the knockout stage by taking second spot with seven points, two ahead of the Portuguese side.
With top spot wrapped up before kick-off, Liverpool made eight changes, handing Origi a rare start after his heroics against Wolves.
"We chose that lineup because we wanted to win the game. We needed fresh legs," Klopp explained.
"We needed desire to play this game which is difficult in this hectic schedule to always be on fire for the next game."
San Siro erupted after Takumi Minamino missed a clearance from a corner in the 29th minute, forcing Alisson Becker to parry the ball into Tomori’s path for a simple finish.
But just as the home crowd started to believe in an improbable final-day climb into the top two, Salah struck.
Alex Oxlade-Chamberlain's shot was beaten away by goalkeeper Mike Maignan, but the Egyptian reacted quickly to fire home.
Salah became the first Liverpool player to score 20 or more goals in five consecutive seasons since Ian Rush, who did so for six campaigns in a row between 1981 and 1987.
Tomori was then punished when he gave the ball away to Sadio Mane after the break and although the winger’s shot was well blocked by Maignan, Origi headed in the rebound.
It was the Belgium international’s first goal in the Champions League since he scored the second in a 2-0 win in the 2019 final against Tottenham Hotspur.
The Rossoneri played with more purpose in the second half but could not find an equaliser, Franck Kessie squandering their best chance when he was denied one-on-one by Alisson.
"We wanted to give a joy to our fans but we didn’t manage it," disappointed Milan coach Stefano Pioli said.
"We have learnt a lot in these six matches."