The shooting occurred last Friday morning in the 2700 block of Duffy Street.
San Bernardino County Sheriff's Department officials said the 4-year-old boy got access to the weapon and accidentally opened fire on his 2-year-old cousin, who died at a hospital.
After several interviews, investigators determined 53-year-old Cesar Lopez, the victim's grandfather, left the gun in a place that was accessible to kids. Lopez was arrested and booked for child endangerment and felon in possession of a firearm.
Lopez was released from custody on bail shortly after 1:30 a.m. Tuesday, according to San Bernardino County Sheriff's Department inmate records.
The records also indicated that Lopez did not have any court appearances scheduled.