This is very subjective and environment-dependent, and my opinion is orthogonal to qsp's answer based on my experience.
My PhD topic was a continuation of my MSc topic with the same advisor. However, halfway through I found another topic, unrelated to the first one, that really interested me. Long story short, I ended up with a sandwich thesis (this was planned from the beginning) consisting of 3 published papers on the 1st topic, and having published 8 papers on the 2nd topic to fill my CV (plus 2 papers on a third topic from a completely different field, and 2 other dydactic texts in lesser peer-reviewed journals). This was enough to graduate with honors (1st topic) and to get a prestigious grant on the 2nd topic which is my main research interest now and on which I'm building my scientific career. I'm very pleased with this outcome. (I abandoned my 1st topic altogether as eventually I lost interest in it.)
So if anyone asked me if they should work on unrelated topics during their PhD I would without hesitation advise to go for it: one broadens their knowledge (some ideas from one topic may be useful for the other), builds a bigger professional network, learns to work on different things in parallel, and ― like me ― may find a topic that is a much better fit than the original one. And I think it should be considered an advantage, as it shows one is open-minded and flexible ― and it was by my thesis referees and the grant committee.
At least at my institute, it's rather common that PhD students are involved in a number of projects on different topics, lead by different senior scientists, and also conducted by themselves. One of my friends is actively involved in ~5 of them, and keeps doing well in each.
But, as I said in the beginning, this is subjective. Some people may simply not be suited for it; some advisors may dislike it (having a conflict with one's own advisor is almost always a bad idea; on the other hand, a PhD is a time to build one's independence and scientific maturity, but this is a different issue); if someone is in a short (e.g., 3 years) program with fixed duration, indeed it might be a better idea to focus on one topic for the time being (I did my PhD in 5 years); if someone loves their topic, why should they look for something else? Etc.
So one should judge by themselves if it's a good thing to work on multiple projects. This is advisor/institution/field/culture/perspectives/... dependent, so there's no one universal "yes/no" answer.