Terms were not disclosed but ESPN's Adam Schefter previously reported the deal would be for four years.
"I'm having a hard time even putting into words how excited I am to be the new head coach for the Los Angeles Chargers," Lynn said in a statement. "This is really a dream come true. I want all of our fans to know that we're going to start by putting together a great staff and we're going to put together a team with the heart and will of a champion."
Lynn spent the last two seasons with the Buffalo Bills, first as running backs coach and then as offensive coordinator. He also served as the team's interim head coach for the final game of the 2016 season.
Lynn's hire marks the first official transaction for the team since announcing their move from San Diego to Los Angeles.
"One thing that's very clear about Anthony Lynn is he's a leader. He's a natural-born leader," said team president for football operations John Spanos. "As you can tell, I am very excited about the leadership qualities he's going to bring to our team. He is really going to communicate and connect with our players.
"He's had a number of great coaching influences in his life and as a former player who won two Super Bowls, Anthony knows first-hand what championship pedigree is all about. We couldn't be more excited to have him lead our franchise into this exciting new era of Chargers football."
Buffalo led the NFL in both of Lynn's seasons with the Bills in both rushing yards (2,630 in 2016 and 2,432 in 2015) and rushing touchdowns (29 in 2016 and 19, tie in 2015).
Lynn is the franchise's 16th head coach and first African-American head coach. He is expected to meet with reporters next week.
Lynn replaces Mike McCoy, who was fired by the Chargers after going 27-37 in four seasons.
The Chargers won only nine games in two seasons and missed the playoffs for the sixth time in seven seasons.
A Texas native, Lynn played running back at Texas Tech and spent six seasons in the NFL, including stops with the Denver Broncos and San Francisco 49ers. He was with the Broncos when they won consecutive Super Bowls in 1998 and 1999.
Lynn mostly has experience as a running backs coach in the league, including stints with the Jacksonville Jaguars, Dallas Cowboys, Cleveland Browns and New York Jets before landing in Buffalo.
ESPN's Eric D. Williams and The Associated Press contributed to this report.