The Chargers sent their first- and fourth-round picks this year and fifth-round pick next year to the 49ers.
"Picking at No. 17, we had about 15 players we felt really good about at that pick," Chargers general manager Tom Telesco said. "I'd say about seven of those 15 we felt were impact players. He was one of those seven, and we just we had to get him."
San Diego needed a bruising back to help take the pressure off Rivers, and they got it in Gordon. He set the FBS record for career rushing average with 7.79 yards per carry.
Gordon replaces Ryan Mathews, who left for Philadelphia as a free agent after a spotty five seasons in San Diego.
San Diego's running game was one of the most anemic in the league last year. The Chargers scored only six touchdowns on the ground, three by Mathews. Gordon rushed for 2,587 yards last season, second-most in FBS history behind Barry Sanders' 2,628 yards in 1988, and 32 touchdowns.
"He just has some explosive ability," Telesco said. "And going into this draft, we were talking about trying to find some game breakers, some impact players on both sides of the ball, and increase are team speed. And Melvin can do all of that."
Gordon also set the single-game rushing record with 408 yards in just three quarters against Nebraska on Nov. 15, edging the old mark of 406 held by former Chargers star LaDainian Tomlinson since 1999. The record fell the next week when Oklahoma's Samaje Perine ran for 427 yards against Kansas.
Gordon was the second running back taken in the first round after Georgia'sTodd Gurleywent 10th overall to the Rams. This year marked the first time since 2012 that a running back was selected in the first round.
Gordon said he believed the Browns, Dolphins and Chargers were potential landing spots for him in the draft.
Chargers director of college scouting Kevin Kelly attended Gordon's pro day in March, talking with the Wisconsin running back afterward. However, Gordon said the Chargers canceled a scheduled pre-draft visit.
Gordon is familiar with the San Diego area. He worked out in preparation for the scouting combine at EXOS training facility in nearby Carlsbad, California.
"I'm ready to come in there and compete," Gordon said. "Ryan Mathews is gone, and there's a chance to come in there and play. You've got some backs in there that know the system and have played the game. I'm excited to learn from those guys, but I'm definitely ready to come in and compete because that's what I got drafted to do."
A rumored trade of Rivers to Tennessee, which would have allowed the Chargers to take Heisman Trophy winner Marcus Mariota of Oregon with the second pick, didn't materialize.
Rivers, San Diego's starter since 2006, has said that with so much uncertainty surrounding the team's possible move to the Los Angeles area, he's likely to play out his current contract, which expires after this season, rather than agreeing to an extension.
The Associated Press contributed to this report.