Answer:
Well you can think of it as an arbitrary convention,You more or less have to memorize the gender of each noun, although you can often (but not always) tell whether a word is masculine or feminine by looking at its ending. Masculine nouns often have these endings.