The incident occurred about 3:47 a.m. near an apartment complex in the 38500 block of 10th Street East, the Los Angeles County Sheriff's Department said in a statement.
Deputies at the scene said they initially responded to a report of loud music at a party. As they were conducting an investigation, a 60 to 65 pound pit bull "aggressively charged" at deputies and bit one of them on his left knee. The deputy was not seriously injured.
The dog was restrained by a person at the scene, but as deputies awaited paramedics, the animal got loose again and charged at the deputies, authorities said. At that point, two deputies shot at the pit bull from a 5- to 7-foot distance, and the dog went back to the rear of the apartment complex and into the carport area.
Deputies followed the dog in an attempt to corral the animal and prevent any other attacks. When they got to the carport area, deputies found the teen on the ground suffering from a gunshot wound to the chest.
Deputies rendered aid until the boy was transported to a local hospital, where he died, sheriff's officials said.
The 17-year-old was identified by his aunt as Armando Garcia.
"He was trying to stop the dog from attacking the cops, and they shot both of them, I guess," said Nick Perez, a friend of Garcia.
Sheriff's officials gave additional details about the incident at a news conference.
"We believe that when the individual came out from behind the building, which was approximately 40 feet away from where the shooting occurred, he may have been struck by one of the skip rounds," sheriff's Capt. Christopher Bergner said. "It is what we're calling an extremely, extremely unfortunate incident at this time."
The same deputy who was bitten was also struck by a "skip" round, sheriff's officials said. He was treated at a medical center and released.
Homicide Bureau detectives responded to the scene, where a section of 10th Street was closed.
Local residents said pit bulls are often seen running loose in the neighborhood.
"Every house on this left-hand side has pit bulls," neighbor Michelle Robinson said as she pointed toward some nearby homes. "Sometimes I'll stop and wait until the owner comes and gets it away from me."
Garcia's mother, Roberta Alcantar, said her son wanted to change his life around.
"He wanted to change his little brother's life around. He wanted to go to school, college and better himself. He said he was done with his past life," she said.
Aunt Amber Alcantar said her nephew died trying to save a dog that wasn't even his.
The pit bull's owner said her dog was just excited and did not mean any harm. She said her pet was "a big dog with a baby's mind."
LASD officials said deputies had responded to the area at least four times for loud music and gang activity in the past two months.
Sheriff's officials said based on the pit bull's condition, it will be euthanized.
Anyone with information about the incident is asked to call the sheriff's department at (323) 890-5500.