Rooney moved ahead of Denis Law to become the second-highest goal scorer in United's history when he struck with the final goal in the 2-1 win over Swansea on Saturday.
Rooney's first league goal since October could not have come at a better time for his under-fire manager.
Van Gaal's team looked like going nine matches without a win when Gylfi Sigurdsson's header looped over David de Gea to equalise Anthony Martial's eighth United goal.
But luckily for the Dutchman, Rooney came to his rescue when he deftly flicked the ball past Lukasz Fabianski in the 77th minute.
Van Gaal, who lined his team up in a 3-4-2-1 formation, was hoping for a change in fortunes at the start of the new year, but for the most part, his team served up another dull display.
The 64-year-old will not care too much, however
Rooney's goal buys him more time to turn things around at Old Trafford and his team are now fifth in the league - just two points behind Tottenham.
There was no sign of any Jose Mourinho scarves outside Old Trafford before kick-off.
United's encouraging performance against Chelsea had restored a certain amount of confidence in Van Gaal, it seemed, but what followed in the opening 45 minutes was the same old drivel from the hosts.
Ander Herrera tricked his way into the box in the first minute, but Federico Fernandez put in a crucial block
Thereafter, United were dour.
Twenty-nine minutes had passed before the first shot on target arrived
Luckily for United, Wayne Routledge volleyed straight at De Gea.
United did not test Fabianski until the 33rd minute
In reality, it was not much of a test for the Swansea stopper
Juan Mata's quick thinking allowed him to find space in the box from Herrera's quick free-kick, but his shot dribbled into Fabianski's hands.
The home fans became annoyed at their team's performance and their complaints were understandable
With three at the back, United had an extra man in midfield, but they were slow to turn defence into attack
Groans were heard as United passed back and sideways with regularity.
It came as no surprise when there were a few boos from home fans when the half-time whistle went
It was the ninth successive game that United had failed to score in the first half at Old Trafford.
The home fans had their spirits lifted two minutes after the break
Ashley Young crossed to Martial, who powered a header in from eight yards
Van Gaal rose to his feet and held his arms aloft
United almost threw their lead away when Andre Ayew was left unmarked in the box
The Ghanaian headed Sigurdsson's cross on to a post and the ball dropped to Angel Rangel, who went down as he jostled for the ball with Matteo Darmian
The travelling fans demanded a penalty, but Jon Moss booked Rangel instead.
Martial broke into the box twice, but failed to test Fabianski and United paid the price
Modou Barrow, given space down the left, crossed to find Sigurdsson, who looped a header over De Gea.
The home fans bemoaned another sloppy goal, but Rooney came to the rescue
After another pacy dribble down the left, Martial flashed the ball across the box and the United captain flicked the ball in.
Fabianski could have equalised in injury time when he came up for a corner, but he headed wide and United held on for a welcome win.
Source : PA