Data centers are facing an image problem. The tech industry is spending millions to rebrand them.

With community opposition growing, data center backers are going on a full-scale public relations blitz. Around Christmas in Virginia, which boasts the highest concentration of data centers in the country, one advertisement seemed to air nonstop. “Virginia’s data centers are … investing billions in clean energy,” a voiceover intoned over...