Correlation != causation. Could be that, because cities become tech hubs, and because cities tend to lean left, that anyone who wants to work in tech will move to a city and be influenced by the left-leaning culture. I've known people who were farther right, went into tech, moved to cities, and are now farther left.