The shooting happened about 3 p.m. in the 2800 block of West 23rd Street, police News Affairs Officer Joshua Purkiss said.
The boys were handling the gun when it discharged, striking the victim in both arms and chin, police News Affairs Officer Hector Alfaro said.
Paramedics took the 12-year-old boy to Mount Sinai Hospital in critical condition with multiple gunshot wounds, Fire Media Affairs said.
A 16-year-old boy, who was not home at the time of the shooting, was charged with misdemeanor reckless conduct for bringing the gun into the residence, Alfaro said.