Productivity differences

I worked at a corporate company for 2 years and fully working from office even though I’m a software developer. Recently, I transitioned to fully remote job as software engineer and damn bot, my productivity increases a lot.

At my old job, I can get things done for days for simple tasks but at home, so many things can be done in few hours. I just couldn’t focus at the office. It’s weird because I thought I could have been more distracted when I’m at home.

Does anyone go through the same and what is the science behind it?