Controversial decisions hand Man Utd victory over 9-man Chelsea
The Mexico striker scored in the 75th minute to inflict the league leaders' first loss of the season and put United just a point behind Chelsea.
United had thrown away a two-goal lead established inside 12 minutes. Robin van Persie saw his shot turned in by Chelsea defender David Luiz before getting on the scoresheet himself.
Chelsea fought back as Juan Mata curled in a free kick just before half time and Ramires headed in an equaliser eight minutes after the break.
Chelsea defender Branislav Ivanovic was sent off in the 63rd for bringing down Ashley Young, and striker Fernando Torres received a second booking for diving.
Just after Hernandez's winner, a steward in front of Chelsea fans appeared to be hit by an object and fell to the ground. He was still receiving treatment as the match ended.
Chelsea had not lost at Stamford Bridge in a league match to United since Roman Abramovich bought the club in 2003, and he watched in frustration as his side's comeback counted for nothing.
Chelsea will have a chance for revenge on Wednesday when the teams meet again in the League Cup.
Early on, Chelsea appeared to be missing captain John Terry, who was serving the second game of his four-match ban for racially abusing an opponent.
After just four minutes, United ripped through Chelsea's defense down the right with Young laying the ball off to Rooney, who squared to Van Persie in the penalty area.
The Netherlands striker's shot came off the post but it bounced off Luiz into the net.
Chelsea's brittle back line was sliced through again in the 12th when Rafael da Silva was given too much space to storm down the right flank unchallenged.
The defender slipped the ball through to Antonio Valencia, who crossed to the unmarked Van Persie to sweep in his ninth United goal since arriving in August.
United were playing with confidence, pinging the ball across the turf with ease and precession.
Chelsea took time to assert themselves on the visitors, but kept United goalkeeper David de Gea busy for the rest of the half.
It took an outstretched right foot from the Spanish goalkeeper to keep out Luiz's free kick while Jonny Evans turned the ball onto the post as he attempted to block John Obi Mikel's effort.
And from the resulting corner, De Gea's feet were again the barrier as Gary Cahill's header was blocked.
Torres, though, was struggling to find the target, although he drew a fine, one-handed save from a header.
The pressure paid off for Chelsea a minute before the break,
Eden Hazard was brought down on the edge of the penalty area by Rooney, who earned his first booking of the season. Mata superbly curled the free kick inside the post to haul Chelsea back in contention.
The momentum was with Chelsea — and continued after the break as United's defense was the one to be exposed.
The equaliser came eight minutes into the second half as United failed to close down Chelsea's fluid attacking play.
Mata took the ball to the byline and found space to whip in a cross that Torres headed across to Oscar.
The Brazilian then chipped across to Ramires, who rose above Tom Cleverley to head past De Gea.
As the hosts continued to harry the United defense, Hazard wasted a chance to put them in front when De Gea's boot blocked his effort.
But Chelesa were reduced to 10 men in the 63rd when Ivanovic brought down Young, halting his advance to goal.
Six minutes later, referee Mark Clattenburg infuriated Chelsea again as Torres was dismissed.
The Spain striker received a second yellow card after being adjudged to have gone down too easily under Evans' challenge.
Hernandez restored United's lead in the 75th, 10 minutes after replacing Cleverely.
Van Persie's initial shot appeared to be creeping into the bottom right of the net after Cech got a touch to it but the goalkeeper hacked the ball away.
It fell to Rafael, whose shot was turned into the net by Hernandez, although the striker later accepted he might have been offside.