Right now, only you and your employer know you have been fired. They probably want to get rid of you ASAP, but they cannot. You will still work through your "Kündigungsfrist" or at least be paid, even if you are "freigestellt".
You still have a bargaining mass. The money they have to pay you from the moment they fired you to the moment you actually have your last day.
Offer them the option to terminate your contract even earlier. They can get rid of you like tomorrow. If you both sign an "Aufhebungsvertrag". And what this contract says if entirely up to both parties. Fact is that if you do that, you have not been fired. You both agreed that you would not continue working together. That's a difference. Nobody will know you have been fired.
However, there are drawbacks. Your employer has to agree. Maybe your remaining wages to be paid are not enough for them to agree. Obviously, people will draw their own conclusions from the fact that you agreed to an "Aufhebungsvertrag". And more importantly, as such a contract is your own free will (in contrast to being fired), you will not get unemployment benefits for some time.
Make sure you get a positive "Arbeitszeugnis". Due to German law, you need a lawyer to check if it actually is positive. Seriously. I could write a full page of great things about you and in the secret language of German HR, I could have called you a stupid, lazy, aggressive drunkard.
The first step is to get a lawyer. Because they already have a lawyer. And you don't want to fight unarmed. Do not believe random people on the internet (like me) when you can have professional support.
Some additional information on German working contracts:
We have a legal minimum notice period that works for both quitting and being fired/laid off. This is called "Kündigungsfrist". It's legal minimum is 4 weeks when you start and goes up in steps up to 7 months after 20 years of employment with the same company. So it's fairly normal to resign or be fired and still having to work for weeks or months.
The only way an employer can fire you on the spot is a breach of trust like stealing from the company or lying. Both has to be documented good enough to hold up in court. As you can never be sure if something does survive a court procedure, most companies that do have to fire someone on the spot also fire the offender regular, so at least that's the fallback if the court procedure goes the wrong way.
The only way to lose your job effective immediately without a legal cause is if the company files for bankruptcy.
"freigestellt" means that formally you still have to work because of your notice period, but your employer already told you to stay home. You will still get paid as if you had been present. This happens for example you are working with sensitive information or key customers and the employer does not want to risk a disgruntled employee to work his key resources.
As the contract can be cancelled by any side only with regards to the notice period, if both parties agree that they don't work with each other any longer, they can agree to sign an "Aufhebungsvertrag" (dissolution contract) which can contain anything they chose. Any notice period (or even none), any payment they decide, or anything else they wish (for example a clause that they do not talk about the reasons for this dissolution).
Germany does not use a system of references but instead written testimonials called "Arbeitszeugnis". Every employee is entitled to get one from his employer. As the courts have ruled that this has to be "constructive and positive", HR has developed a secret language, packaging negative meanings in positive sentences. So if it reads "employee was always communicative and social", it means you were always drunk and flirting inappropriately. "Employee always tried to the best of his abilities" means that guy is a total loser and despite trying hard, never got any task done correctly. One needs a specialist to actually "read" that language.
Sources:
BGB is the "Bürgerliches Gesetzbuch" which I think translates to civil law. But I'm really not a lawyer, you will need to ask one for the minute details.
Legal minimum notice periods can be found in §622 BGB.
The obligation to give an employee an "Arbeitszeugnis" can be found in §630 BGB
"Arbeitszeugnis" have to be positite and constructive as per the court decision of the German supreme court BGH 26.11.1963 - VI ZR 221/62.
Information on when and how firing people is legal has it's own section with 26 paragraphs in the KSchG (Kündigungsschutzgesetz).
Dissolution contracts are basically part of a thing called "Vertragsfreiheit" which means that two consenting parties can agree to any contract they like as long as it does not contain something illegal. That's derived from article 2 of the constitution.
All of this is taught in any professional education in Germany, but law is not exactly the subject that young people like most. People find it boring and study it for the written test and forget about it as soon as they drop the pencil at the end.