Commanding Officer

Who would be considered the commanding officer at a crime scene?

Perhaps a detective or something? How would that work?
I was thinking more along the lines of something big like a mass shooting or bank robbery.

It depends on the nature of the crime, where it took place, and the assets/resources of the first responding agency. All these factor in to who will ultimately take over the case.

For instance, in your mass shooting scenario, if the town or locality that the shooting took place in did not have the resources to investigate the crime, they would likely hand it over to State Police. If the crime was committed in a state-owned facility, like a state government building, the State Police again would ultimately take over the case, even if the local town police were the first responders.

Same goes for federally owned land.

If the crime was committed across state lines, it becomes a Federal Case. If the crime was severe enough, the feds may intercede on the investigation, but usually will ask permission of the agency in control at that time. They may offer resources or man power that the controlling agency could use to close the case as quickly as possible.

At the scene itself, the first responding officer has control over the scene until relieved either by his direct supervisor or the chief of police, at their discretion.

WWII BIRTHDAY GREETINGS COMMANDING OFFICER FT WORTH QUARTERMASTER DEPOT DRAWING
WWII BIRTHDAY GREETINGS COMMANDING OFFICER FT WORTH QUARTERMASTER DEPOT DRAWING
$9.99
Time Remaining: 18h 24m

WW2 8x10 PHOTO NAVY CHAPLAINS with COMMANDING OFFICER
WW2 8x10 PHOTO NAVY CHAPLAINS with COMMANDING OFFICER
$9.95
Time Remaining: 7d 13h 21m
Buy It Now for only: $9.95

USS Charles Ausburne Commanding Officer Original Photograph 6 1 2 x 8 1 2
USS Charles Ausburne Commanding Officer Original Photograph 6 1 2 x 8 1 2
$24.99
Time Remaining: 9d 21h 50m
Buy It Now for only: $24.99

Failed to Salute Military Report card to Commanding Officer ca 1940s
Failed to Salute Military Report card to Commanding Officer ca 1940s
$9.63
Time Remaining: 13d 20h 8m
Buy It Now for only: $9.63