Teuvo Teravainen and Sebastian Aho also scored for the Hurricanes.
Goaltender Cam Ward stopped 21 shots in the win.
The Hurricanes, who are still very much alive in the playoff race, had been winless in six games for the first time since 2014.
Travis Konecny scored for the Flyers, who had their 12-game unbeaten streak snapped. The Flyers had won six in a row with a 10-0-2 record entering this game against the Hurricanes.
Petr Mrazek had 31 saves for the Flyers.
Williams put the Hurricanes on the scoreboard first with a nifty goal at 4:40 of the first.
Teravainen gave Carolina a 2-0 lead at 5:39 of the second. It was Teravainen's 17th goal of the season and the puck eluded Mrazek.
Williams struck again for his second goal of the game at 11:42 of the second on assists from Jordan Staal and Brett Pesce.
The Flyers struggled to generate much offense through the first two periods and managed only 14 shots. Carolina outshot Philadelphia by a whopping margin of 28-14.
Philadelphia came out aggressive in the third and quickly cut the lead to 3-1 when Konecny registered his 16th goal on a gorgeous pass and assist by Sean Couturier at 1:20. Claude Giroux received the other assist.
Carolina's Noah Hanifin was whistled for holding Scott Laughton, giving the Flyers a late power play. The Flyers had some good chances but were unable to connect.
Shortly after the power play, Aho ripped a wrist shot past Mrazek for a commanding 4-1 advantage at 14:23 of the third. It was Aho's 23rd goal of the season.
Carolina outshot the Flyers 35-22.
Philadelphia had six shots in the first, seven in the second and eight in the third and never was able to put consistent pressure in the crease on Ward.
--Field Level Media
Carolina | Philadelphia | |
Justin Williams 3 | Points | Travis Konecny 1 |
Justin Williams 2 | Goals | Travis Konecny 1 |
Justin Williams 1 | Assists | Sean Couturier 1 |
N/A | Power Play Goals | N/A |
N/A | Short Handed Goals | N/A |
Cam Ward .955 | Save Percentage | Petr Mrazek .886 |
Cam Ward 21 | Saves | Petr Mrazek 31 |
Team | Shots | Goals | Power Play | Penalty Kill | Penalty Mins | Face Offs Won |
Carolina | 35 | 4 | 0-1 | 2-2 | 6 | 27 |
Philadelphia | 22 | 1 | 0-2 | 1-1 | 4 | 20 |