What types of visas are available?
For a short-term - tourist - stay of up to 90 days you must apply for a so-called Schengen visa (C visa) at the German mission in your country of origin.
If you are staying longer than 90 days in Germany, you need a national visa (D-visa). This visa also allows you to apply for a residence permit afterwards.
In principle, it must be clear at the time of entry how long you intend to stay and the correct visa must be applied for. An extension of a Schengen visa or the application for a subsequent residence permit in Germany is only possible in absolutely exceptional cases.