We want to divide $kn$ people into $k$ groups of $n$ people.
Line up the $kn$ people by order of student number.
The person with the lowest student number gets to pick her team. She has $\dbinom{kn-1}{n-1}$ choices. Now the unchosen person with the lowest student number gets to pick her team. She has $\dbinom{(k-1)n-1}{n-1}$ choices. Now the unchosen person with the lowest student number gets to pick her team. She has $\dbinom{(k-2)n-1}{n-1}$ choices. And so on. Multiply.
Another way: Let us divide our $kn$ people into $k$ teams, one of which is to wear uniforms of colour $C_1$, one to wear uniforms of colour $C_2$, and so on. It is easy to see that this can be done in $\dbinom{kn}{n!,n!,\dots,n!}$ ways.
Here we used the multinomial coefficient, which simplifies to $\dfrac{(kn)!}{(n!)^k}$.
Now the teams stay intact, but decide to play their sport at a nudist camp, and shed their uniforms. Then the $k!$ permutations of uniform colour collapse into one. Thus the number of divisions into $k$ uniformless teams is $\dfrac{1}{k!}\dfrac{(kn)!}{(n!)^k}$.
For the toy example $k=2$, $n=3$, the first method gives $\binom{5}{2}$. The second gives $\frac{1}{2!}\binom{6}{3,3}$. Each of these is $10$.
For $40$ people and groups of $10$, the first approach gives $\binom{39}{9}\binom{29}{9}\binom{19}{9}$.
The second approach gives $\frac{1}{4!}\frac{40!}{(10!)^4}$.