Which of the two laptops should I get for my work as a software engineer if cost is not an issue for either of them? I'm a bit reluctant to go with MacBook since I've used windows my entire life and a bit worried if I'll be able to work efficiently with the mac OS.
If you want the best of both worlds, you're kind of stuck these days - the Lenovo can't run macOS & the M1 can't run Win for Intel, only Win for ARM.
If instead you looked at a late model Intel Mac, say from 2019 or so, then you could run both on it either from VM or Boot Camp, legitimately & with fewer hoops to jump.
If you need to code for macOS or iOS, you have to have a Mac with Xcode.
The Mac itself is not too tough to get the hang of, I've watched many transition over the years. I've always worked on it taking about two months to transition [don't try to fight the paradigm by attempting to force Win shortcuts onto the Mac - it doesn't go well]. There are resources for Windows switchers - Apple KB - Mac tips for Windows switchers