Every noun is either one or the other and you just have to learn them. But there are some clues. Un problema is a problem as it’s masculine even though it ends in an a. Look out for irregular nouns.
Oh, look! There’s some thing sleeping in the trees! Common nouns are the names of things, that’s people, places or objects, while a proper noun is the name of a particular person, place or thing.