The thing with managers is that they have to understand the work being done well enough to make decisions about direction and resource allocation, while also having tons of people skills. In tech you either get a manager who doesn't have a technical background and just doesn't understand the thing they're managing, or you get someone with a technical background who stereotypically doesn't have the necessary people skills to manage well (it's a stereotype, but I find it to also be true, including about myself).
Part of it is also that as a programmer you learn to micromanage what the computer is doing, to be very precise with your instructions so the program won't fail. When managing people for the first time the instinct is to do the same: give very precise instructions even an idiot could follow. That's exactly the wrong approach to manage effectively (except for a few rare circumstances). That's why programmers tend to make bad managers who micromanage, they've been trained wrong by their prior work.