The phrase "Hell on Wheels" was originally used to describe the itinerant collection of flimsily assembled gambling houses, dance halls, saloons, and brothels that followed the army of Union Pacific railroad workers westward as they constructed the First Transcontinental Railroad in 1860s North America.

The huge numbers of wage-earning young men working in what was a remote wilderness, far from the constraints of home, proved to be a lucrative opportunity for those with expertise at separating such men from their money. As the end of the line continually moved westward, Hell on Wheels followed along, reconstructing itself on the outskirts of each town that became, in turn, the center of activity for the Union Pacific's construction work.

The town was literally on flat cars and moved as the line was completed. They were really tents made to look like buildings.

More Info: en.wikipedia.org