THOUSAND OAKS, Calif.—Ian David Long, identified as the gunman in a mass shooting here, was a high-school baseball player remembered as a perfectionist who dropped the sport his senior year in part to focus on joining the military.

When Long’s baseball coach sat down to write about him in a yearbook, one word came to mind: “Intensity!”

Long...