Gustavsson was selected in the second round, 55th overall by the Pittsburgh Penguins during the 2016 NHL entry draft. On 16 June 2017, Gustavsson signed a three-year, entry-level contract with the Penguins.[2] He continued his development on loan in Sweden with Luleå HF through the 2017–18 season.[3]
On 23 February 2018, the Penguins traded Gustavsson to the Ottawa Senators (alongside defenceman Ian Cole, a 2018 first-round pick, and a 2019 third-round pick) in exchange for forward Derick Brassard.[4] On 23 March 2018, Gustavsson was assigned to the Senators American Hockey League (AHL) affiliate, the Belleville Senators, after the conclusion of the SHL season.[3] With the 2020–21 season delayed due to the COVID-19 pandemic in North America, Gustavsson was loaned to Södertälje SK of HockeyAllsvenskan.[5] He went 11–7–0 in 19 appearances before returning to the Senators.[6] On 17 March 2021, Gustavsson made his NHL debut. He entered in relief of Joey Daccord, who departed the game with an injury. Gustavsson stopped all eight shots faced in the 3–2 shootout loss to the Vancouver Canucks.[7] He made his first career start on 22 March, stopping 35 shots in a 2–1 win over the Calgary Flames. The victory was the first of his NHL career.[8] In the 2021–22 season Gustavsson played in 18 games with Ottawa, starting 16 of them, compiling a record of 5–12–1. He also played in 20 games with Belleville.[9]
On 12 July 2022, Gustavsson was traded by the Senators to the Minnesota Wild in exchange for goaltender Cam Talbot.[9] He started the season as the backup to Marc-André Fleury and got his first NHL shutout on 10 December 2022 in a 3–0 win over the Vancouver Canucks.[10] The Wild made the playoffs and Gustavsson made his NHL playoff debut versus Dallas Stars on 18 April 2023 in the first round of the 2023 Stanley Cup playoffs. He made 51 saves, setting the Wild franchise playoff record, in a double-overtime 3–2 win.[11] The Wild were eliminated by the Stars in the first round.[12] In the offseason, Gustavsson signed a three-year contract with the Wild.[13] He again split the net with Fleury during the 2023–24 season, starting 43 games for the Wild, but the team failed to make the 2024 Stanley Cup playoffs.[14]
The Wild entered the 2024–25 season with Fleury and Gustavsson in net, but Fleury declared this to be his last year.[14] On 15 October 2024, Gustavsson became the 15th goaltender in NHL history to score a goaltender goal, the 10th to directly score a goal, and third to do so on a power play, in a 4–1 win over the St. Louis Blues.[15]
Gustavsson was selected to play for Sweden's junior team at the 2018 World Junior Ice Hockey Championship. He stopped 29 of 31 shots in a 4–2 victory over the United States to get Sweden into the gold medal game in the tournament.[16] In the gold medal game, he let in two goals as the team lost to Canada 3–1 (the third goal was on an empty net). For his play, he was named the tournament's best goaltender and a silver medal.[17][18] He represented Sweden at the 2024 IIHF World Championship and won a bronze medal. He saved 20 of 22 shots for the 4–2 win over Canada in the bronze medal game.[19]