This is likely very dependent on individual circumstances, but I'll try to answer in general. I think there is a balance between pursuing a personal passion and 'putting food on the table', as it were.
It is very difficult to earn a living unless you do something others find valuable. In my career, I have lost count at the number of hours I have put into completing tasks that don't interest me. However, I try to take a professional attitude and learn something from each of these 'nuisance tasks'. In retrospect, I've actually learned many useful skills and, as an added benefit, slowly gained the trust of others in my field.
As this trust grows, I plan to pursue things that are more interesting to me. Ideally, my credibility will be higher, which may help others join in my interest. I recall one academic telling me once he/she had tenure, they were going to write op-eds and try for more mainstream influence. There's a need to pay your dues in most fields.
I would encourage you to be open and honest with this question to your adviser and peers in your field to learn about specific dynamics. Ideally, you can find some overlap between your passion and the research task proposed by your adviser, even if it's just getting practice actually producing a publishable manuscript.