The 49ers (9-1) trailed by 16 points in the first half of their 36-26 victory at Levi's Stadium in Santa Clara, Calif.
Garoppolo threw three of his scores in the second half. He completed 34 of 45 passes for 424 yards and threw four touchdowns and two interceptions, joining Joe Montana and Steve Young as the only quarterbacks in franchise history to throw for at least 400 yards and four scores in one game.
"Anytime you're in a sentence with those two names, it's always an honor," Garoppolo told reporters. "I've got a long way to go to catch up with those two. They did some great things around here."
The Cardinals (3-7-1) took a 3-0 lead on a 26-yard Zane Gonzalez field goal on the game's opening drive. Cardinals quarterback Kyler Murray connected with Larry Fitzgerald for a five-yard touchdown on Arizona's next drive, for a 10-0 lead. Murray connected with Pharoh Cooper for another five-yard touchdown toss 9:07 before halftime for a 16-0 advantage.
Garoppolo hooked up with tight end Ross Dwelley for a four-yard touchdown on the next possession and kicker Chase McLaughlin made a 43-yard field goal as time expired in the first half, making the score 16-10 at the break.
The 49ers took their first lead of the game on the first drive of the second half, with Garoppolo connecting with Dwelley on a five-yard scoring throw. The Cardinals regained the lead three drives later, with Gonzalez hitting a 43-yard kick. Garoppolo connected with Kendrick Bourne for a two-yard touchdown to give the lead back to the 49ers in the fourth quarter.
Arizona answered again, with Murray rushing for a 22-yard touchdown, giving the Cardinals a 26-23 lead with 6:35 remaining. Garoppolo threw a 25-yard touchdown to Jeff Wilson Jr. with 37 seconds remaining for the go-ahead score. The 49ers added to the lead with D.J. Reed scoring on a fumble return in the final seconds.
"We just didn't execute good enough," Murray said. "They kind of came back before that half was over and held the ball from us a little bit. Then they got the ball back after the half and scored. We were right there to win it. It just came down to the last couple of drives. We got that interception and just didn't finish."
Murray completed 24 of 33 passes for 150 yards and two scores for the Cardinals. Forty-Niners receiver Deebo Samuel had eight catches for 134 yards.