It has to do with the nature of the job, itself, in theory.
Originally, it was hourly workers vs. managerial workers. Workers get told what to do and basically get paid for their steady production output, so an hourly model for compensation is reasonable. They get paid overtime so employers won't skimp on hiring new employees to save on benefits and overhead and grind the regular employees into dust with grueling hours on a regular basis.
Since there is not a specific production output, and the productivity gains are more in how managers organize the work of those below them, there's not a lot of advantage to making them work longer hours, and, because they control their own work to a much larger extent, it doesn't make sense to try to do that, either.
As we saw the rise in "white collar" positions, where the work is more technical and based on intellectual output vs physical labor, but those workers don't directly supervise others, you have kind of an in-between status there. Basically, those workers have a lot of latitude and leeway in how they get their work done, and the concern is less how many hours they spend on the job and more on getting the job done.
If I'm an exceptionally good production line worker, I can do a lot of work output on a consistent basis. My total output is linked to my time on the line, and there's always more work for me to do.
If I'm a good "white collar" worker, I might be a better worker if I find a work efficiency improvement/solution in 25 hours vs. someone who finds that same solution but takes 35 hours. Should the person who takes 10 hours more be compensated more? No, probably not. So, instead, theoretically, both workers get compensated for getting the job done, and are paid on a salaried basis. Since workers want to please, and employers can always find work for good workers to do, it often works out that "exempt" workers do work more than 40 hours a week for no additional compensation.
However, it also means that the company can't sit there and watch the clock and say "you only worked 38 hours last week and I want to dock you pay." If there is an issue, they have to show that the job is not getting done. Exempt employees don't check in and check out the same way hourly workers do, and when they take leave, they can't be required to take an hour here, and hour there, that counts against their PTO banks. In some cases, it's half or full days, in others, they only get charged for full days off. If I need to take two hours for a doctor's appointment, the assumption is that I'll make it up somewhere along the line, or will, on my own volition, put in for that half or full day if I take enough "nickel and dime" time away that it eventually adds up to that much that I haven't made up. Or I don't, and I'm able to not charge the time because I'm good enough at getting my work done, so it doesn't become an issue.
Some companies struggle with not micromanaging or controlling their employees, but that's how it's supposed to work.