Generally speaking, it's good to have goals, a purpose, and a creative outlet.
Tangentially, I know that personally, something I struggle with, that has caused me frustration, is that I often feel like in my work life, I am forced to work on projects that I think are basically bullshit. I'm being asked to implement a feature that I believe is useless, or to work on a project that my intuition tells me will get axed later, have very little or no impact, or is based on terrible design decisions and just painful to work on. That leaves me feeling powerless and unmotivated, and has pushed me into a depression in the past.
As a programmer, having a side project can be a nice way to get what you can't always get at work, which is a sense of self-determination. A sense of working on something you actually believe in, something you can actually take the time to design cleanly and properly. Side projects can be a much better creative outlet than work. I hope that I can eventually find a job where I get to work on something I truly, really believe in. That's been very difficult to find so far though.