It's not the real-world-thing that has a grammatical gender. It's the word that is used to name the thing. Often there are more than one words that you can use to name a thing. Let's take "car". This can be in German:
Das Auto (neuter)
Der Wagen (male)
Die Karre (female)
»Auto« is the standard word for cars, »Wagen« is a little bit outdated and often used for some bigger limousines, and »Karre« is a shabby car. So if you have a rusty 15 years old limousine, you can use all three words. All three words can mean the very same automobile. But they have different genders.
Also note: A grammatical gender is a property of a language. It's not about biological gender. But if there is something that is biological male or female, then very often the grammatical gender is the same (take this as a rule of thumb, it's a quite safe rule). But there are exceptions:
Most famous exception is the German word for »girl« (a female human, between newborn and about 20 years old). You might think it had to be a female word, but it is not. The German word for »girl« is:
Das Mädchen (neuter)
The reason for this exception is, that »Mädchen« is a diminutive, and all diminutives are always neuter. (This is a hard rule with no exceptions. So it's a stronger rule than the sex=gender-rule which is only a rule of thumb.) (»Mädchen« a diminutive of »die Maid« which is female, but »Maid« is outdated and no longer used in a normal conversation)
Das Weib (neuter) (outdated word for »woman« or »wife«)
Die Tunte (female) (a la-di-da gay man)
Das Kind (neuter) (»child«, used for both biological genders)
Das Baby (neuter) (»baby«, used for both biological genders)
You better stop thinking of a »gender« of a word. Think of it as a »noun class«, because this is what it really is. It is just a grammatical property of nouns.
English has only one noun class, i.e. all Englisch nouns belong to the same noun class, and this class has no name. Italian has two noun classes, their names are "male" and "female". Swedish also has two noun classes, but the are not "male" and "female", but "utrum" and "neuter". German has tree noun classes, which are "male", "female" and "neuter". And the African language Swahili has 22 noun classes.