It happened around 2:00 a.m. Thursday in the 5500 block of Ludlow Street.
Police say a man approached the victim and shot him in the head with the BB gun.
The suspect fled but the gun was later recovered under a car at 56th and Ludlow.
The 21-year-old victim was taken to the Hospital of the University of Pennsylvania in stable condition.