Cody takes its name from Buffalo Bill Cody, who agreed to be buried there if they named the town after him. There were presumably two further stipulations: (1) that they waited until he was dead before they buried him, and (2) that they filled the town with as much tourist tat as they could possibly manage.