Two people were killed and three others injured in an attack that broke out during a neighborhood Fourth of July gathering in a Southern California beach city, police said Friday.