Like thousands of others, Megha Mathur moved to the Indian city of Gurgaon for a coveted job in tech. She soon realized she wouldn’t be able to live there very long. The pollution was so bad she had to check an air quality app on her phone several times a day to see whether it was safe to go outside without a mask.

“Having to live like that can cause a lot of anxiety and stress in knowing that’s constantly your life,” Mathur, 27, told CNN Business. “Even though there are exciting opportunities in terms of companies and jobs, it just wasn’t a place that I could see myself living long term and I think a lot of people share that opinion.”

Gurgaon, around 25 miles from India’s capital New Delhi, is one of the country’s newest tech hubs — home to global players such as Google (GOOGL) and Microsoft (MSFT) as well as some of India’s biggest startups like food delivery firm Zomato and India’s biggest hotel chain OYO. Mathur, who worked for Zomato, stayed there only nine months before moving with her fiancée Harshvardhan Singh to the southern city of Bangalore.

“If you want to work in tech then Bangalore is your number one choice,” says Singh, who left OYO for Flipkart, India’s top online retailer that was bought by Walmart (WMT) last year. Often described as India’s Silicon Valley, the city is also the main India base for Amazon (AMZN), Flipkart’s main rival, the birthplace of ride-hailing firm Ola and home to leading outsourcing companies such as Infosys (INFY) and Wipro (WIT).

Gurgaon and Bangalore have exploded in the past two decades as the main centers of India’s tech boom, with millions like Mathur and Singh taking up the highly prized and well paid jobs that come with it. The cities underscore one of the main dilemmas the country faces: The rapid growth needed to drive its $3 trillion economy and sustain 1.3 billion people has spawned an environmental emergency.

India’s energy needs are rising as it tries to extend the manufacturing and tech boom to lift millions more out of poverty. That means more factories, more offices, more residences and vehicles.

The country has set itself ambitious targets since signing the Paris Climate Agreement, aiming to source 40% of its energy from renewable sources like wind and solar by 2030. There has been significant progress — renewable energy now accounts for nearly 23% — but India is still one of the world’s largest oil importers, and more than half of its electricity still comes from burning coal.

A perfect storm

When Sanjay Gupta and his family first moved to Gurgaon in 1999, there was hardly anything around. “It was sparse, desolate, and for most requirements we would have to go to Delhi,” he said. “It was a distance away from everything that we needed.”

Gupta, who worked for American Express, soon moved overseas for stints in New York and Singapore, before returning to Gurgaon as the company’s India head in 2006. By then the tech frenzy was firmly underway. “You always felt that you were in a construction war zone,” says Gupta, now the CEO of AI education startup EnglishHelper.

Today, the drive into Gurgaon — now officially known as Gurugram — is a blur of glass buildings and company logos. It’s now one of India’s fastest-growing cities but mostly makes headlines for having the world’s most toxic air, based on an index compiled by Greenpeace and AirVisual that measures the level of fine particulates.

As recently as the first week of November, Gurgaon and neighboring New Delhi were blanketed by a layer of smog so thick that officials declared a “public health emergency,” dozens of flights were canceled and schools were closed. Traffic pollution and construction dust are partly to blame, but the annual burning of crop waste by local farmers makes the situation worse at this time of year.

It’s a public health crisis that resurfaces every winter, thanks to what experts refer to as a “perfect storm” of pollution. And it only seems to be getting worse.

People wearing pollution masks have become an increasingly common sight in Gurgaon. (Ruhani Kaur/Bloomberg/Getty Images)

“Gurgaon had an opportunity to make this a world class city and we are nowhere close to it,” says Latika Thukral.

A former Citibank executive, Thukral quit her job in 2004 and co-founded I Am Gurgaon, a citizen’s group that has been working to increase the city’s green cover, clean up its water supply and create more open spaces.

“I think the exodus is happening,” Thukral says. “There will be no water, pollution is at its peak. Why would people not move out?”

Bangalore’s tech boom preceded Gurgaon’s and its transformation was even more dramatic. The city, now officially called Bengaluru, used to be dubbed “Garden City” or “Pensioner’s Paradise.” Not any more. Where Gurgaon has poisonous air, Bangalore has gridlock — the number of vehicles in the city has gone from around 1.4 million in 2000 to more than 8 million this year.