The 28-year-old midfielder had not played since November, when he was diagnosed with ulcerative colitis – a chronic bowel condition.
Jonny Hayes and Joe Shaughnessy put Aberdeen in front, before Anderson’s late consolation.
Fletcher had been training with the Scotland squad ahead of their friendly against Australia on Wednesday.
The testimonial at Pittodrie on Tuesday night was a benefit game for Neil Simpson, who was part of United manager Sir Alex Ferguson’s side when he guided Aberdeen to the European Cup Winners’ Cup in 1983.
Fletcher, who took the captain’s armband when coming on as a second-half substitute, received a loud reception from a sell-out 21,000 crowd.
Sir Alex told his club’s in-house television channel MUTV: “It’s been quiet progress for the boy.
“He joined in training a couple of weeks ago and it’s one of those situations where you say: ‘Let’s see how he does because he has had a really difficult time in the last year’.
“He’s got to the stage now where he feels he needs a game. I let him join Scotland this week but he wanted a game so I said: ‘Come to Aberdeen and join up afterwards’.
“I’ll give him 20 to 25 minutes.”
Rio Ferdinand, Paul Scholes and Ryan Giggs all started the game, with former United players Dwight Yorke and Clayton Blackmore on the bench alongside Fletcher.
Dons veterans Brian Irvine, Dougie Bell, Doug Rougvie and Steve Tosh all made an appearance, while Simpson kicked the match off before making a hasty exit.
Hayes gave the hosts an unexpected lead after 38 minutes after a mistake from Scholes allowed the Aberdeen man in, before Shaughnessy’s second-half strike doubled their advantage.
Anderson did pull one back for United with nine minutes remaining but Aberdeen held on.