Maybe stop putting risky or annoying shit next to residential areas?
It's not that simple. Someone lives near anywhere you might want to build something. Even if you build in the remote reaches of Alaska, some busybody will get their undies in a twist that it destroys some aspect of the wilderness they personally value, even if that person has never been to Alaska and never intends to.
More practically, you want to build power plants near where the demand is because shipping power costs money and can cause other issues. You want data centers near people both to hire people working there, hiring people to build it, being close to transportation to haul gear in and out of the data center, and so on and so on.
We've been arguing about siting industrial facilities for probably 150 years now. This is not a new problem, it's just what people are hyped up about today.
What I think is ironic about your comment is clustering industry used to be one of the primary values of a city. You wanted all your factories and industry concentrated in one spot. Then people got all upset about how noxious industrial cities were so industry moved to the suburbs and exurbs. If we want to have a high GDP and wealthy standards of living, we're going to have to build industrial complexes somewhere and that somewhere can't always be "anywhere I can't see it."