It seems strange that a sport would be founded from an illegal activity. But, a number of factors contributed to the growth of moonshine running and other illegal liquor sales in the South from the 1920s until well into the 1970s.
The first factor was prohibition. The nationwide ban on making or selling alcohol opened the market to small producers. While some farmers had been making corn liquor for their own use, they suddenly had the opportunity to sell what they made to a wider audience -- so long as they didn't get caught. Moonshiners would hide the stills they used to make the moonshine deep in the backwoods of the South. If the police found stills, they'd destroy them, wrecking the moonshiners profit and making the production of the next batch nearly impossible.
After prohibition ended, the opportunities for moonshiners didn't. Many counties and towns in the South were dry, so legitimate liquor sellers were kept from those markets. Moonshiners could not only access customers in dry towns, but they also found that the best was to keep their profits high was to keep sales off the books. That is, they didn't pay federal taxes on the sales they made. Of course, the government doesn't take kindly to people not paying their taxes, so they sent agents to the South, who the moonshiners called revenuers, to collect what the government was owed.
The other factor that led to moonshining and whiskey cars persisting was simply the lack of opportunity in the South. The Great Depression persisted longer in the South than in other areas of the country, since the South didn't have the industrial production base that would have benefitted from the run up to World War II. Small farmers endured crop failures, and the mills that drove the region's economy remained closed. Unemployment was high. And, when a family was facing ruin, choosing to make do or run moonshine (or both) seemed like the right thing to do. It didn't hurt that outrunning and outsmarting the police could be both financially and emotionally rewarding.