Hi @Nguyen
As your wife is an EU citizen working in Germany, you have the right to receive a residence card.
In general, foreigners are required to come to Germany with the correct visa. Your situation is different as you either never had a visa or your visa is expired. In the case of family members of EU citizens, the EU courts have ruled that is it not permissible to reject a person’s application solely because they do not have the correct visa. This is now included in the German guidelines on how the EU freedom of movement laws are to be applied in Germany. The relevant section is point 2.4.2.2. of the guidelines here:
https://***.verwaltungsvorschriften-im-internet.de/bsvwvbund_03022016_MI12100972.htm
However, staying illegally in Germany (illegaler Aufenthalt) is punishable as a crime. You may be charged with this crime. Depending on how long you have lived illegally in Germany and if you have any other legal issues, you could then be considered a threat to public order and security. In this case, they could refuse to give you a residence card.
In short, you cannot be refused a residence card solely because you do not have a valid visa. But you can be refused if you are additionally considered to be a threat to public order, possibly due to having stayed in Germany illegally.
I advise you to seek out legal advice and/or migrant advisory services to assist you during this process.
Best,
Éanna