There are ten digits: 0, 1, 2,...8, 9

Think of this question from perspective of the person who sets the code.

When he picks the first of the 5 digits, how many choices does he have? Exactly 10 choices!

When he picks the second of his 5 digits, he can again choose from 10 options.

For digits 3, 4 and 5 he also has 10 choices.

So he has 10*10*10*10*10 choices or 10^5.

To contract: if repetition is not allowed, there are

10*9*8*7*6 choices.

For the first digit he can choose any number 0-9.

For the second digit he can choose any number 0-9 EXCEPT the number he chose for the first digit, so he has 9 options.

And so on.