Let \( x \) be the number of games Ahmadullah's basketball team played last season. According to the information given:
\[ 21 = \frac{1}{3}x + 12 \]
To solve for \( x \), we first subtract 12 from both sides:
\[ 21 - 12 = \frac{1}{3}x \]
\[ 9 = \frac{1}{3}x \]
Next, we multiply both sides by 3 to eliminate the fraction:
\[ 9 \times 3 = x \]
\[ x = 27 \]
Thus, the number of games they played last season is 27 games.