Las Vegas had long been an important stop on the Old Spanish Trail, the route from Santa Fe to Southern California. It had been intermittently settled, and a series of forts erected to protect the important watering spot. Once the Mormons settled in Utah, it increased in importance as it was on the closest route to the sea.
Permanent settlements with mining, ranching and farming didn't come until the early 20th century. But the area had served as a way stop for centuries. And as a way stop, a bit of poker or other games could always be found. In 1910 that was brought to a halt as Nevada became the last state to outlaw gambling. But as a state with plenty of miners and the like there was always a good amount of it to be had.
In 1931 work began on the Boulder (later Hoover) Dam on the Colorado. And Las Vegas was the closest town to the build site. The population exploded virtually overnight from about 5,000 to over 25,000. Most of this new population was single men who had come for the work. Much of the rest was people who came to service the workers. Vegas exploded with saloons, casinos, dance halls, brothels and the like. Most of this was illegal. But the workers weren't about to complain, and the locals were making money hand over fist. Eventually the federal men overseeing the dam project got sufficiently scandalized they made a company town, Boulder City, and banned visits to Vegas.
The state and city however realized exactly how profitable gambling could be and in 1931 the ban on gambling was lifted (or at least legalized it under licensed entities). Despite the ban Vegas was a very popular destination for the thousands of dam workers.
In 1934 the dam was completed. The dam workers moved on, but the city now had a reputation as a recreational town. They also had an almost limitless supply of water and electricity provided by the dam. And they began to market themselves as a tourist destination. The Flamingo was the first modern Casino proper, built in 1946. And that's when the real boom started. Here was a town where everything (almost) was legal. And anything illegal was pretty available. A glittering oasis shining in the desert... and importantly it was only a few hours from Los Angeles and Hollywood. Mormon money, mafia support, Hollywood glamor, and an atmosphere of permissiveness let the town take off.
Vegas needed a few things to really get started: Money, clientele, transportation, water and cheap electricity, anything goes attitude, and experience working around the law. Stuck between conservative Utah and (at the time) conservative California, Las Vegas was a place where folks could go, let their hair down and be a bit naughty. The Mob mostly kept the town clean and shiny. They were the only ones allowed to rob the visitors, and they did it at the roulette wheel.
Basically Vegas was the right place at the right time. Lots of other places could have been Vegas. Palm Springs was another desert oasis destination. But it didn't have the legal gambling, the expertise, or the transportation infrastructure. So it became where the LA elite would go to swim, golf, and play tennis. That's where they went to relax. Vegas was where they went to party. And the rest of the world followed to party with them.