To learn the German language in Germany, you first need to secure admission in a language school in Germany. There are a lot of schools in Germany offering German language courses to international students. You can search for these schools online and apply. Once you get an admission letter, you can use it to apply for a language course visa. Some of the documents you need to apply for a German language course visa are an admission letter, passport, passport-sized photos, proof of accommodation for the time of language course, completed and signed application form, and proof of sufficient funds to cover all expenses, which is normally in the form of 8640 euros in a blocked account in Germany. It is very important you show you are financially sound to survive in Germany.
However, I will first advise you to first study the German language in your home country to a respectable level, let's say B1, and then apply to a higher level in Germany. There is a high chance of your visa getting rejected if you apply to study A1 in Germany, especially if there is a Goethe Institute in your home country.