Gagne was drafted by the Flyers in 1998 and had played his entire career in Philadelphia. He has one year left on his contract, which will pay him $5.25 million.
"In adding Simon to the Lightning today, we acquire a very talented player that will play along side our top forwards," Lightning vice president and general manager Steve Yzerman said. "With his combination of speed and skill we are excited to have him with us and grateful he was willing to waive his no-movement clause.
"This trade not only makes us a better team in the short term, it helps create long-term flexibility for us, which all along has been one of our top priorities."
In 664 NHL games, Gagne has 259 goals and 265 assists. He ranks ninth on the Flyers' career list in goals and 10th in points and games played. He had 17 goals and 23 assists in 58 games last season and added nine goals and three assists in 19 playoff games as Philadelphia reached the Stanley Cup finals before losing to the Chicago Blackhawks in six games.
"I'm looking at this opportunity as a new challenge and a new start," Gagne said. "I'm really looking forward to playing with guys like [Vincent] Lecavalier, [Steven] Stamkos and [Martin] St. Louis. I'm excited to be a member of the Lightning and I'm looking forward to starting next season in Tampa Bay."
The 6-foot-4, 215-pound Walker has played in 304 career regular season games over seven seasons. The 30-year-old Alberta native was originally selected by the St. Louis Blues in the third round of the 1998 draft.
Walker had two goals, three assists and 90 penalty minutes in 66 games last season with the Lightning. While with St. Louis, Chicago and Tampa Bay, Walker amassed four goals, 26 assists and 444 penalty minutes during his NHL career.
"We like the way Matt plays," Flyers GM Paul Holmgren said. "He's a character-intense player. He plays physical. He's a stay-at-home guy that is a good penalty killer. On our team he can buy us dirty minutes and not be a liability, but be a positive force and help and defend our own zone."
Walker said he has "always wanted to play in Philly" and that he would be a "good fit" with the Flyers.
"My initial reaction was pure excitement," Walker said.
The 30-year-old Gagne led the Flyers in goals three times -- including two 40-goal seasons -- and twice in points. He was chosen as the team's MVP in two seasons and was selected to the NHL All-Star game twice.
"Anytime you're talking about a young man that has brought as much to the organization that Simon has, it's very difficult," Holmgren said of dealing Gagne.
Gagne, who scored a career-best 47 goals during the 2005-06 season, scored the winning goal in overtime of Game 4 against Boston in the second round and the decisive goal in Game 7 of that series to complete Philadelphia's comeback from a 3-0 deficit.
Scott Burnside covers the NHL for ESPN.com. The Associated Press contributed to this report.