Galiardi, a 25-year-old Calgary native, had five goals and nine assists in 36 games with the Sharks in 2012-13.
"I don't think it's still fully sunk in that I'm going to be on the Flames," Galiardi told the team's website. "It's been a dream of mine ever since I was a little kid. I think ever since I got into the NHL, I've always had a soft spot for the Flames even though I was playing against them. I always figured when the time came when I was an unrestricted free agent I would try my best to make it to Calgary.
"The fact that it happened this soon and when I was a restricted free agent, it's great."
The Sharks had acquired Galiardi in a trade with the Colorado Avalanche, along with Daniel Winnik and a 2013 seventh-round pick in exchange for Jamie McGinn, Michael Sgarbossa and Mike Connolly on Feb. 27, 2012.
"The fact that I was going to get traded was out of the blue but [Sharks general manager] Doug Wilson was great," Galiardi said. "Once we got to that process, he let me know which teams were interested and when I heard Calgary, it was a no-brainer for me and I said that was my team that I wanted and was pretty much only interested in. Then I and [Flames GM] Jay Feaster talked and worked out a deal. It all pretty much came about in the last couple days."
A 2007 second-round pick of the Avalanche, Galiardi has 39 goals and 87 points in 221 NHL games in five seasons.
"We are thrilled to add a young player with TJ's size and versatility to our lineup," Feaster said in announcing the trade. "He can play left wing or center, he competes hard, is a very good energy player, and he is only 25 years old. The fact that he is from Calgary, lives here in the offseason and played for the Hitmen [in the Western Hockey League] is an added bonus, as he is yet another player who is excited to be part of our program going forward."