The Flames trailed 2-0 in the first but rallied to tie it six minutes into the third on Mark Jankowski’s short-handed goal.
Getzlaf then was able to corral a loose puck in front of the goal and directed a backhand through Mike Smith’s legs for his second game-winner of the season.
It was only the fourth time in 17 games the Ducks have led after the second period. They are unbeaten when they lead after 40 minutes.
Jakob Silfverberg and Adam Henrique also scored for Anaheim. Ryan Miller made 37 saves and tied Andy Moog (372) for 17th on the career wins list.
Matthew Tkachuk also scored for Calgary, and Smith stopped 21 shots.
Anaheim got on the board at 8:37 of the first when Silfverberg carried the puck into the Calgary zone and ripped a slap shot for his fifth goal of the season. Henrique gave the Ducks a two-goal lead three minutes later when he pounced on a rebound after Smith stopped Josh Manson’s shot from near the blue line.
With less than three minutes left in the first, Calgary scored on the power play when Tkachuk redirected Elias Lindholm’s drive past Gibson.
Jankowski tied it when he stole the puck from Anaheim’s Brandon Montour in the neutral zone and shot it just over Miller’s glove while leading a 2-on-1 rush.