I've seen graduate students act as course developers for their advisor's MOOC or play a key role in helping their advisor with some other endeavour that is not related to research. What is the motivation for them to do this if it does not help them graduate or get publications?
Why do anything that's not strictly required to graduate? For the experience. Because it sounded like fun. Maybe they're interested in teaching and really excited about the opportunity to develop a curriculum from scratch? Maybe they're excited about the pedagogy behind online courses and want to learn more? Maybe it's a rare opportunity to try something new that most academics don't get to do?
If you only do things that are strictly required to graduate and publish, you'll miss out on a lot of interesting experiences, and you'll be less interesting to a hiring committee than someone who went above and beyond seeking out experiences to develop as a researcher and teacher. The goal with grad school shouldn't be to just publish and graduate. While it is sufficient to just publish and graduate, it's hardly a good way to make the most of your time in grad school. Go for the exciting teaching project. Volunteer to help organize that conference. Apply to that interesting summer school. Get involved in that intriguing research project. If an exciting opportunity comes along, take it. Develop a MOOC instead of TAing yet another semester of calculus (or whatever grad students in your field normally do). That's my philosophy at least, and that's why I would have jumped on an opportunity to develop an MOOC.
I've seen graduate students act as course developers for their advisor's MOOC or play a key role in helping their advisor with some other endeavour that is not related to research.
At least in Europe, where PhD students are employees, the answer is pretty simple - because it is their job, and the professor can and will, in her/his functions as manager of the students, also assign them tasks that are not directly related to their PhD project.
My employment contract in Austria was actually pretty clear about this - nominally, my job consistent of 50% research, 35% teaching, and 15% "others", which boiled down to helping with all sorts of university administrative tasks. For instance, I was once helping with re-writing the programme description of one of our master programmes. Of course this was only nominal, and I would honestly think that in practice, for me, both the research and the "others" parts ate into my time budget for teaching (but I never explicitly tracked this, since neither me, nor my professor, nor the university administration cared as long as things got done).