The incident happened at 11:15 p.m. Tuesday on the 3500 block of North Broad Street.
Police say the 22nd District officer had just gotten off from work.
He was riding a motorcycle at Broad and Tioga streets in North Philadelphia when he collided with a car that was making a turn.
Police say the off-duty officer was knocked off his bike and started walking toward the car.
"He actually grabbed onto the door handle, from what I am told, and at some point the vehicle took off dragging him," said Lt. John Stanford.
Police say the off-duty cop identified himself as a police officer. He told his commanding officers he saw the man reaching for the center console and what he thought was a weapon.
The officer fired his gun an unknown amount of times. One bullet shattered the window of Temple University Hospital's Outpatient Services Center, which was closed and empty at the time.
Police searched for hours for the other vehicle involved in the crash.
Then around 5:30 a.m. Wednesday, the driver of a dark green Chevrolet Monte Carlo turned himself in.
Police taped off the car in the 600 block of West Cambria Street in Philadelphia's Fairhill section. The car has front-end damage and a bullet hole in the side.
Car with bullet hole taped off on W Cambria, involved in crash with off-duty cop on motorcycle in North Philly. pic.twitter.com/L1XtZoaXrM— Katherine Scott (@KScott6abc) June 1, 2016
A few blocks away, on the 2800 block of Fairhill Street, a police vehicle sat outside the driver's home. The driver wasn't hurt.
As of noon Wednesday, he was still being questioned by police.
So far no charges have been filed.
As for the off-duty officer, he was taken to Temple University Hospital to be treated for minor injuries.
Action News is told Temple University security cameras recorded the crash that preceded the gunfire.
Police are working to determine what led to the crash and why the off-duty officer opened fire.