I'm learning the first declension and I am confused on how the word "terrae" is used as a genitive but can be used as a dative. How do I translate if I am given just the word "terrae?" I noticed it can also apply to the plural, as well as other declensions.
Context will answer that question for you. If you say "lands" by itself in English you will likely think of it first in the nominative. In a sentence, though, you might say of the lands, to the lands, etc, which gives you the context to know which it is.
Terrae is no different.
Terrae magnae sunt. (nom)
The lands are great.
Aquam terrae portat. (dat) or (gen)
It carried water to the land
He carried the water of the land.
In the last example, you'll know which it is by other sentences around it. In other cases you'll know which it is because any other uses just won't make sense.
Welcome to the site! The short answer is that without context, many translations of terrae are possible: e.g., "of land," "to land," "lands," "of the land," "to the land," "the lands," "of a land," "to a land," "earth," "of earth," "to earth," etc. In context, however, the precise meaning is usually clear.
The first thing to recognize is that translation between many languages often involves choice between different expressions, since different languages force different choices. This is just an inherent problem with translation and not anything particular to Latin or English.
The large number of possible translations above can still leave a beginner feeling that Latin is hopelessly vague and ambiguous; however, this is no more true of Latin than it is of English. For example, the words "the deer" could have more than four dozen Latin translations, depending on whether you assumed "deer" is singular or plural, which underlying word you used to translate it (cervus, cerva, damma, etc.), which ending you used (6 to 7 different ones for each), and whether you chose to add an equivalent of one of two words that occasionally translate "the." From the Latin perspective, English would seem horribly vague and ambiguous.
The reality is that the average Latin sentence in context is no more vague than the average English sentence. As you grow in experience with Latin, you will learn to resolve apparent ambiguities more and more easily by other means.
In beginning texts that tend to use simple sentences out of context, whether a word like terrae is genitive or dative can be harder to discern. For instance, in a sentence like "Amīca puellae librum dat," the case of puellae is technically ambiguous; however, the default for a verb like "dat" in Latin and for a verb like "gives" in English is that it requires three entities: a giver, something given, and a recipient. That default would require a translation like: "The friend gives the/a girl a/the book." In both English and Latin, it would be possible to use the word "dat"/"gives" while omitting any giver or thing given (e.g., "The friend gives the (girl's) book); however, such an omission is possible only in specific context and is not the default usage. You could even translate the sentence as "The friend of the girl gives," but this would be possible only in a very marked context in both Latin and English.
As a matter of homework and doing translation exercises, many meanings may be possible; however, within actual literature, Latin writers tried to be just as clear and expressive as English writers and just as rarely wrote sentences that were truly ambiguous.