Witnesses told police Timothy Wilks and a friend had approached a group of people outside a family trampoline park in Nashville, holding large knives.
Mr Wilks was then shot by a 23-year-old, who told police he had had no idea it had been a "prank" and had been acting in self-defence.
Mr Wilks's friend told officers the "prank" had been for a YouTube video.
No-one has been arrested over the death.
Several families had been inside the Urban Air trampoline and adventure park, which describes itself as "kid friendly" and "family fun", at the time of the shooting, 21:20, local news outlet WKRN reported.
Robbery "prank videos" are relatively common on YouTube, sometimes involving fake firearms, balaclavas or getaway vehicles.
Some have millions of views - though many of those are themselves faked, with all participants being "in" on the video and acting their part.
But YouTube brought in rules banning dangerous or threatening pranks two years ago.
That includes "pranks that lead victims to fear imminent serious physical danger or that create serious emotional distress in minors".
Threats with weapons and fake robberies are specifically listed as offences that would result in the video being taken down.
The new rules were brought in after a number of high-profile precedents.
In 2015, the tech giant refused to remove a video in which vlogger Sam Pepper tricked a man into thinking his friend had been shot and killed.
But in 2017, a stunt by two YouTubers ended in a death, when Monalisa Perez, then 19, shot at her boyfriend, Pedro Ruiz, through a thick book, which he believed would stop a bullet.
Perez was imprisoned for six months in March 2018 for the shooting.
And YouTube banned dangerous pranks about 10 months later.