Silicon Valley pitches for smart cities and military descriptions of future battle environments are awfully similar. That's not entirely coincidental.
Deep historical and institutional links aside, you can chalk it up to convergent engineering. Most people live in unevenly urbanized, socioeconomically unstable, and ecologically unsustainable cities. They are variously labelled as users, potential enemy combatants, or citizens by the different types of organizations setting up increasingly dense systems of algorithmic monitoring, prediction, and control, but the technologies, methods, and even goals are fast becoming impossible to distinguish (nowhere faster than in China, perhaps, although not for lack of trying elsewhere).
The main scenario tech companies have in mind is one of a prosperous, gleaming city filled with deeply monetized and continuously engaged inhabitants; for military organizations, large, poor cities populated by the networked restless with nothing to lose. Neither is implausible — they are instead, like every scenario, selective ways of looking at a complex reality.
Here's another selective way of looking at a complex reality: going by the current trends in technology, economics, and geophysics, the typical large city of the mid- to late-21st century is going to be one of lethal heat waves every year, chronic water difficulties, and food insecurity of the kind that shaped, say, Roman politics during the Late Republic and Early Empire (that's on top of, and ignoring for the sake of argument, not at all unrelated issues of economic and social inequality and instability). With three or more degrees Celsius of overall warming, New York will more or less live or die by its storm walls, but high densities in places like India and the South of China will be monstrously difficult to sustain, and require powerful technologies to monitor, predict, and interact with urban populations.
The most likely use case for all those sensors, drones, and programmable (but not end-user-programmable) infrastructure won't be administrating an ecologically and socially healthy urban environment, but rather making the permanent crisis easier to manage.
Getting comprehensive telemetry of massive multi-causal urban collapse, in the not-quite-the-best scenario.
The future, sometimes, works out better than expected (but not without a lot of hard work, and that rarely by the same people who made up the mess in the first place). A combination of a faster than expected transition to a zero-carbon economy, humane and orderly migration away from whatever areas become impossible to maintain, large investments in sustainable infrastructure wherever it's needed: we have or can develop the means to do all of that, and more. The more knowledge, resources, and technology a civilization has, the more ecological disasters become matters of sociopolitical failure rather than capricious fate. We (for far from uniformly responsible values of "we") made the current and oncoming mess, but it's within our ability to handle it with a minimum of ensuing horrors.
But whatever future we end up building, the hardware and software we're threading through our cities — which by then will be as boring when working as sewage or food logistics, and almost as necessary — will have its greatest impact not through the placement of interactive ads or the airborne delivery of pizzas, but as part of the basic toolkit that will define how — and for whose benefit, or following whose vision — we interact with each other and with the world.