Jordan Lunsk, 39, of the 6400 block of Argyle Street was charged following the incident late Saturday morning.
Police say the off-duty officer was outside his home, working on a car, when Lunsk stopped in the 6400 block of Oakley Street at 11:53 a.m.
Lunsk's dog relieved itself on the officer's lawn, and the officer allegedly asked Lunsk to clean it up.
An argument started and Lunsk left, police say.
However, Lunsk allegedly returned a short time later and punched the officer several times in the face and head and then pulled the officer's hood over his face.
Lunsk moved around behind the officer, police say, and the officer drew his pistol from a hoster on his hip. The officer fired backward, striking Lunsk in the right thigh.
Lunsk was treated at the hospital for his injuries and released. The officer was treated for facial cuts and bruises and released as well.
The incident is being investigated by Internal Affairs and will be reviewed by the District Attorney's Office, police said.
The officer was placed on administrative duty pending the outcome of the investigation.
Lunsk has been charged with aggravated assault, criminal trespassing, simple assault and related offenses.
In a news release, Philadelphia police noted Lunsk had three priors: two burglaries and a DUI.