There is some mistake in your argument.
If you look at a sphere with radius one, then in order a word has distance 1 to the center if they differ in one place. Since it is of length 5 then we can choose one of this place. BUT for each place we have a (q-1) way to change it . So the number of codes in this sphere is 1+5(q-1)=5q-4.
As you said all of this sphere are disjoint. If there are N codes then we need the total word to be less or equal to q^5. Then we need
. There fore as desired.