If you're a creative person, like a developer, it's inefficient.
Context switching is expensive, and going home for the day is a big context switch.
If it's 5:00 and you have 30 minutes left on something, most likely it'll take something like two hours tomorrow to get back into and finish it.
If you always go home exactly at 5, it means you are either constantly being inefficient and doing the context switch, you are not doing anything late in the afternoon to avoid the context switch, or you are extremely good at both estimating and optimizing your time so all your tasks are quantized within working hours. While things may work out to look like the third case sometimes, I find it hard to believe anyone is that good that it can happen literally every day, which leads me to believe they're often doing one of the other two things.
And just to take this further: there's a massive context switch for the dev team when a burned out developer leaves after 1-2 years, compared to the 9-5 dev who's still there and happy.
Context switching is expensive, and going home for the day is a big context switch.
If it's 5:00 and you have 30 minutes left on something, most likely it'll take something like two hours tomorrow to get back into and finish it.
If you always go home exactly at 5, it means you are either constantly being inefficient and doing the context switch, you are not doing anything late in the afternoon to avoid the context switch, or you are extremely good at both estimating and optimizing your time so all your tasks are quantized within working hours. While things may work out to look like the third case sometimes, I find it hard to believe anyone is that good that it can happen literally every day, which leads me to believe they're often doing one of the other two things.