Companies have long-term leases on their offices. Office space is the single most expensive line-item on most companies financials. They want to maximize the use of these very expensive assets, and having workers in the offices accomplishes this.
From a more practical perspective, working from home is great for more senior workers who are already established in their careers and know what they're doing, but it's hugely detrimental to the career development of younger workers, who largely learn from working alongside their older/more senior counterparts. Communicating over email, slack, zoom, etc., just isn't the same, and you can see this across pretty much every white collar domain--even programming. This is why companies have pretty much settled on hybrid schedules; it allows for the in-person collaboration while still allowing workers greater freedom in where they work.
And while you're complaining about "the workers" consider that essentially all blue-collar jobs have been on-site full-time even through the pandemic.