Matthews, who grew up in Southern California and walked on at USC, signaled his return to Los Angeles on his Twitter account.
The Packers' career sack leader with 83.5, Matthews registered only 3.5 sacks last season, the lowest single-season total of his career. That was despite his playing in all 16 games in the final season of a five-year, $66 million contract.
"We want to thank Clay for all that he has contributed to the Packers over the past 10 seasons. As the franchise's all-time sack leader and an integral part of Green Bay's Super Bowl XLV championship, he will be remembered as one of the greatest players in the history of the organization," Packers general manager Brian Gutekunst said in a statement. "Clay will always be a member of the Packers family. We wish him, his wife, Casey, and the rest of their family all the best moving forward."
Matthews, 32, joins a position group that includes outside linebackers Dante Fowler, who signed a one-year "prove it" deal worth up to $12 million before the start of free agency, and Samson Ebukam. The Rams also return starting inside linebacker Cory Littleton, who received a second-round tender after he led the team with 90 tackles and intercepted three passes, returning one for a touchdown, last season.
Although he primarily played outside linebacker and edge rusher, Matthews spent parts of the 2014 and 2015 seasons as an inside linebacker, which likely was a key factor in the Rams' decision to sign him. The Rams recently released veteran inside linebacker Mark Barron and saved $6.33 million in their salary cap, but Barron's departure left a significant hole in the defense.
Rams general manager Les Snead said last week that second-year pro Micah Kiser could be called upon to step into the role, but that the team would continue to explore options in free agency and the draft.
Despite his dip in production last season, Matthews can still be effective. According to ESPN's pass rush win rate using NFL Next Gen Stats, he beat his block within 2.5 seconds on 26 percent of rushes in 2018, 27th among 91 players with 300 rushes.
A 2009 first-round pick (26th overall), Matthews made the Pro Bowl six times in his first nine seasons. He was a first-team All-Pro in 2010, when he was the runner-up to Steelers safety Troy Polamalu for Defensive Player of the Year.
Matthews has 11 sacks in 15 career playoff games, the most in Packers postseason history and tied for fifth in NFL playoff history.
Matthews is the fourth player to sign with the Rams in free agency. Along with Matthews and Fowler, the Rams also signed veteran safety Eric Weddle to a two-year deal worth up to $12.28 million and quarterback Blake Bortles to a one-year deal to back up Jared Goff.
ESPN's Rob Demovsky and Lindsey Thiry contributed to this report.