Terrell Blay was one of two people arrested after the shooting, which occurred at about 6:15 p.m. Saturday, police spokesman Sgt. Mike Andraychak said.
Witnesses said they saw two groups of people involved in some sort of fight before the shooting, police said.
Along with the person who was targeted, four bystanders were shot.
The unintended victims are a 17-year-old boy from El Cerrito, a 22-year-old man from Santa Cruz, a 45-year-old man visiting from England, and a 74-year-old San Francisco resident, police said.
All five victims were taken to San Francisco General Hospital and are expected to survive.
Blay and a 16-year-old boy were arrested shortly after the shooting. The teen's name is not being released because he is a juvenile, Andraychak said.
They were arrested on suspicion of several felonies including assault with a deadly weapon and gang-related offenses, police said.
District attorney's office spokeswoman Erica Terry Derryck said prosecutors have until Wednesday to decide whether to file charges in connection with the shooting.
The shooting was not related to this weekend's San Francisco Pride celebration taking place nearby at Civic Center Plaza.