The Federal police (Bundespolizei) can issue an Emergency travel document (Notreiseausweis) to EU/EEA Citizens (and probably 3rd country nationals who are residents of other EU/EEA countries) under certain conditions:
Emergency travel document for persons without German citizenship
For citizens of the European Union, the European Economic Area or Switzerland, as well as for persons who are entitled to return to these countries, the Federal Police can issue an emergency travel document for a trip abroad or for re-entry. This only applies to avoid undue hardship or for reasons of particular public interest, if the issuance of a travel document by the country's own foreign representation or a foreign authority can no longer be expected in time.
An expired passport can be used:
Important information on issuing passport replacement documents
Identity and nationality must be proven by presenting official documents - generally an expired passport or passport replacement. A copy of this is not sufficient.
The application can be made online, so that the document can be prepaired beforehand and picked up at a pre-agreed place and time:
Electronic application
To speed up the process of obtaining the passport replacement document you need, you can use the online application to send your personal details and the relevant travel data electronically to the relevant border authority, who will contact you promptly. They will also inform you about the modalities for collection.
Sources: