Mike Smith made 45 saves, and Jesse Juljujarvi had a goal and two assists for Edmonton (2-0). Derek Ryan also scored, and Leon Draisaitl added three assists.
McDavid has 26 goals in 31 career games against the rival Flames.
''Playing these guys 10 times last year with no fans got kind of stale,'' he said. ''To have the passion back in the building and the fans as excited as they were, it's good to see that.
''I thought our boys did a good job of responding and it was a good win for us.''
Andrew Mangiapane and Elias Lindholm scored for Calgary, which has lost a record 12 straight season openers.
''I thought we came out a little slow and they were scoring on their power play,'' Mangiapane said. ''They obviously have a good power play.
''I think 5-on-5 it went pretty decent. We just have to come out a little better and maybe it's a little different tonight.''
The Oilers opened the scoring with seven minutes to play in the first period when Warren Foegele put a shot on Flames goalie Jacob Markstrom, and Ryan was there to convert the rebound.
Edmonton made it 2-0 on the power play with 2 1/2 minutes left in the first. Puljujarvi's shot went off a Calgary stick right to McDavid, who scored his first goal of the season.
McDavid got another power-play goal 5 1/2 minutes into the second, firing a one-timer from near the right faceoff dot.
Calgary scored its first midway through the second. Mangiapane was able to track down his own rebound in tight and score on a backhand.
The Flames made it 3-2 five minutes into the third with the man advantage. Matthew Tkachuk made a nice pass from behind the net to set up Lindholm.
But the Oilers regained their two-goal edge 26 seconds later. Cody Ceci sent Puljujarvi in alone and he made no mistake, putting his second of the season past Markstrom.
Draisaitl said it's been amazing seeing Puljujarvi's progression with Edmonton after returning to Finland following his first go-around with the Oilers.
''He's getting better every day,'' Draisaitl said. ''He is hard to play against.
''He has a big body, he skates like the wind and he shoots the puck well. His confidence is coming more and more. It is fun to play with him and to be a part of.''
McDavid completed his hat trick with an empty-net goal.
NOTES: The Flames were without forward Blake Coleman, who was serving a suspension for boarding Winnipeg Jets forward Jansen Harkins on Oct. 6. ... Calgary dressed 11 forwards and seven defensemen. ... F Zack Kassian returned for the Oilers after hitting his head on the ice during a fight in a game against Vancouver on Oct. 7. ... The last time the Flames won a season opener was 2009 with Miikka Kiprusoff in net. The previous NHL record for consecutive season-opening losses was seven.
Flames: Host Anaheim on Monday night.
Oilers: Host Anaheim on Tuesday night.
More AP NHL: https://apnews.com/hub/NHL and https://twitter.com/AP-Sports
Copyright 2021 STATS LLC and Associated Press. Any commercial use or distribution without the express written consent of STATS LLC and Associated Press is strictly prohibited.