There are pros and cons of each.
The commute is much shorter when you work from home. And, as others have pointed out, the dress code is less stringent when you're not among co-workers. However, working from home is a synonym for living at the office. You're never off duty. In particular, there's no natural breaking point when everyone around you leaves for the day. You can get into the grove and being working for hours. Additionally, there's no excuse of "I'll get to it when I get to the office" when all that you need is at your fingertips 24/7. Working from home also allows a flexibility (within reason) of working hours. You can run quick errands in the time saved from commuting. If you don't have a doorman, you can have packages delivered on days you're working from home.
There is a comradery when you are in an office setting (presuming that you like your coworkers) and an esprit de corps. It's much easier to pop over to someone's desk to ask a question or get clarification than it is to make a phone or video call. It's also easy to have a hallway conversation. So, casual learning is greatly enhanced in an office. There is also a cost to working in the office. In addition to the commuting time there is the actual cost of the commute and/or parking. There is the cost of eating out rather than scrounging from the kitchen. On the flip side, there are more working lunches or dinners that are paid for when you're in the office.
Given my druthers, I prefer a hybrid arrangement where I can be in the office or not based on my desired schedule. Since I'm not the boss, I don't have complete autonomy of my schedule, but I do have a good relationship with my boss and we work well together to make things work.