Each word is classified by what is permissible in the instances in which it appears. In English, "three" can be a noun, an adjective, a pronoun, or a numeral. I will use French as the second language in my examples. If a word can be replaced by another word without changing the grammar of the sentence, the two words have the same grammatical class in that instance.
- I have a three.
- I have a (playing) card (with the value three).
- J'ai un trois.
- J'ai une carte (à jouer) (avec la valeur trois).
- I have three cats.
- I have small cats.
- J'ai trois chats. (I have three cats.)
- J'ai des chats. (I have some cats.)
- J'ai les trois chats. (I have the three cats.)
- J'ai les petits chats. (I have the small cats.)
- Three are eating.
- They are eating.
- Trois mangent.
- Ils mangent.
- One, two, three.
- One, two, four.
- Un, deux, trois.
- Un, deux, quatre.
Note: "numeral" can be hard to differentiate from the other classes. It doesn't work if you replace "three" with a word from a different class:
- One, two, three
- One, two, *card
- One, two, *some
- One, two, *small
- One, two, *they
So, "three" isn't a noun, an adjective, a pronoun, and a numeral at the same time, it is only one of those at a time. You should now be able to apply the same process in Portuguese to work out when numbers are nouns.
In regards to your question about the declination of numbers (i.e. whether they are invariable, can be singular or plural, etc.), note that some nouns are invariable (in certain contexts), and some have to be declined.
- I am drinking *a milk. (allowable if "a milk" is the ellipsis of "a serving of milk")
- I am drinking *milks.
It seems from your question that in Portuguese, "ten" is invariable, while "million" can be singular or plural. This doesn't change the grammatical class.