I recently heard that in 2013, Germany banned out-of-hours working. This article says:
Germany's employment ministry has banned its managers from calling or emailing staff out of hours except in emergencies, under new guidelines intended to prevent employees from burning out.
As a PhD-student, I've got several deadlines throughout the year and sometimes I need to work after the regular working hours and in the weekends. I could work at home, but I am always more productive at my workplace.
The thing is, no one is asking me to stay, I am staying out of my pure will. I can simply tell my supervisors that I am not willing to consider the following conference deadline and they would not mind it, it's my decision.
Would it still be illegal if I spend extra time at work or go on weekends?
Although I have the status of a student, "PhD student" in Germany (and many places in Europe) is a paid job. Your employer could be the institute/university, or you could be funded through a scholarship.