That depends on the company and how that company feels about it, but it seems like a very ill-advised activity to me.
If it's causing a problem at work, such as lost productivity or lowering team morale, management should talk to this employee and let them know that this behavior is not acceptable during work hours and constitutes either neglect of duties and/or a conflict of commitment.
I've heard that some companies have a policy that any software developed at that company belongs to that company. These types of policies are generally intended to keep developers from running off with code on their way out the door, but might also extend to the projects this person is working on. Something the employee should think about.
Since I don't know if you are asking as the person working on the side projects, as an irritated/concerned co-worker, or as a supervisor, I would say that in all cases, this is not what this person is paid to come into the office to do (as hugoenn pointed out) and should stop unless they have supervisor approval. Even then, it seems unprofessional.
If the employee is worth keeping and is getting their work done, maybe a flex time agreement with this employee (meaning then employee can work off hours on work stuff and work on side projects during the day) is something that can be explored as well.
But, to answer your question directly: they should only be fired if they have been warned by management not to work on side projects and then continued to do so.