Like a chicken with its head cut off
In a frenzied manner.
Poultry may sometimes run around frenziedly for several minutes after decapitation.
The phrase was known in the USA by the late 19th century. It is recorded in print being used as a simile from the 1880s; for example, this piece about an escaped prisoner in The Atlanta Constitution, July 1882:
"Finding himself free from the heavy shackles, he bounced to his feet and commenced darting about like a chicken with its head cut off..."