The incident happened at 32nd Street and Sixth Avenue, just after 5 p.m.
The area was shut down while officers investigated, with 32nd Street reopening Friday morning.
Chief James O'Neill with the NYPD said two officers responded to a call for a man trying to remove a boot from his car. During their response, officers ran into Akram Joudeh, 32, of Queens.
"30 and Broadway, got a male with a meat cleaver in his hands. He's walking down the block," an officer said over the scanner.
RELATED: Who is Akram Joudeh?
According to O'Neill, Joudeh pulled an 11-inch meat cleaver and ran. Officers tried to use a Taser on the suspect, but he kept running west on 32nd Street.
"He has a cleaver in his hand and you could clearly see it and he is waving it around," Chief James O'Neill said.
At the height of rush hour, cops chased him through throngs of people, finally cornering him on 32nd Street.
While running, the chief said Joudeh ran into the front grill of a marked police cruiser and into a UPS truck, at the same time as an off-duty detective tried to intervene.
"At this point an off-duty detective in civilian clothes attempted to subdue the suspect. The detective was struck in the head by the cleaver, causing a six-inch gash from temple to jaw," O'Neill said.
PHOTOS: Shots fired near Penn Station after officers attacked
The detective, identified as Detective Brian O'Donnell, was listed in serious condition. Fortunately, he was released from the hospital on Friday.
"Drop it, drop it, drop it! Get down!" you could hear officers yell on the scanner.
The other officers at the scene then fired 18 shots at Joudeh, hitting him twice. He was taken to the hospital in critical condition.
A second officer is being treated for a possible graze wound from the shots fired by officers. He is expected to survive.
"I want to commend them for their bravery and performance and duty," Commissioner Bill Bratton said.
O'Donnell, a 16-year NYPD veteran assigned to the 19th Precinct on the Upper East Side, is conscious, alert and has talked to police officials who visited him at Bellevue Hospital.
He has a 6-inch cut on his face, from his temple to his chin, and underwent reconstructive surgery. He lives on Long Island, is married and has three boys.
This video from an Eyewitness News viewer shows ambulances leaving the scene:
Eyewitness News viewer Victoria Ammirato said her office was on lockdown after the shooting -- the elevators were shut down and all people in the office must now exit via stairwells.
I'm in that Fuse building, 10+ floors up. Literally heard the gunshots. OMG. https://t.co/5WYxfSyUuW— Nabalab (@nabalab) September 15, 2016
Investigators said this does not appear to be a targeted attack -- it appears to be an emotionally disturbed person.
Joudeh has 15 prior arrests, most of them sealed, but his criminal history includes larceny, criminal possession of stolen property, criminal mischief and unauthorized use of a vehicle.