In the active sentence, «الدَّرْسَ» is the accusative object. After passivization it occupies the nominative passive-subject position as «الدَّرْسُ».
The case change reflects the changed syntactic relationship. The lesson is still what was written; it has not become the writer.