Forsyth County Sheriff's Office Cpl. Doug Rainwater said in a statement the incident unfolded Tuesday evening on Picklesimer Road in the north end of the county.
Martin Candelas Ponce age 29, was a passenger in the vehicle, and it appeared he was intoxicated.
"He was under the influence and for whatever reason he thought it was a good idea, at nearly 10 at night, to start shooting a gun out the window," Rainwater said.
A deputy happened to be on patrol in the area and heard the shots. Ponce tossed the gun from the car when the deputy pulled up behind the vehicle and turned on the patrol car's blue lights. A K9 officer found the weapon and the magazine.
Because the gun had been modified and was fully automatic, the man could face federal charges in the case, as well. The ATF is investigating.
Forsyth County Sheriff's office reported no one was injured.
The driver of the vehicle was not charged.