Each team in the softball league plays each of the other teams exactly once. For every game, there is 2 team playing. The order is not important because A vs B is same as B vs A
So you just need to makes a combination of 2 that have a result of 21. If there is t number of teams, the number of matches would be:
tC2 = t!/2!(t-2)! = 21
t! / (t-2)! = 21 *2
(t)(t-1)= 42
t^2 -t -42=0
(t-7)(t+6)
t=7 ; t=-6
Excluding the minus result, you got 7 teams.