Michael Ferguson inflicted wounds to the victim’s stomach and arm from inside the vehicle during a confrontation in Lisburn, Co Antrim last week, prosecutors claimed.
Details emerged as the 18-year-old accused was refused bail.
Ferguson, of Mornington Way in Lisburn, faces charges of causing grievous bodily harm with intent and two counts of possessing an offensive weapon in public.
The court heard he was travelling in a Vauxhall Insignia when a bottle smashed in front of it at Trinity Terrace on January 27.
CCTV footage shows the car reversing back as the victim and a friend go towards it, according to a Crown lawyer.
She claimed Ferguson was hanging out the front passenger window “wildly” waving a machete in nearby Longstone Street.
As the victim came into range he was slashed and attacked with the blade before the Insignia is driven off, a judge was told.
Police stopped the car minutes later on the Belfast Road, recovering a lock knife during searches.
The machete was discovered by the side of the road a short distance away.
Prosecution counsel said the victim sustained a 6cm wound to his stomach and chest area.
A further laceration to his elbow was deep enough to reach the bone.
“He stated that as the car first drove past him the front seat passenger shouted at him ‘ You fenian b******’,” the prosecutor added.
“When the car drove off somebody threw a bottle at it, at which point it reversed and the attack took place.”
It was further claimed that during interviews Ferguson sniggered when shown the CCTV footage and when asked to comment replied: “I just think it’s stupid.”
Mr Justice Colton heard the injured man has also allegedly made a threat to the accused.
Despite prosecution submissions that the attack was unprovoked, defence counsel argued that it followed the bottle-throwing incident.
“This is a young man of 18 who should be at home watching TV, there’s no reason to be out causing chaos as the Crown alleges,” he added.
But denying bail, Mr Justice Colton cited the risk of re-offending.
The judge said: “I’m not satisfied there are any conditions I can impose to manage the risk.”