A California teenager was identified by police on Monday as the gunman who killed three people, including two children, at a food festival south of San Francisco.