A test statistic is an observation specific to your observed data that follows a probability distribution under a given assumption. This assumption is usually called the $H_0$.
For instance, in your sample the test statistic (called t-statistic) depends on the observed data ($\bar{x}$ and $s$ are both derived from the data).
Under the assumption that your mean is $\mu_0$, the statistic you computed will follow a certain distribution. The probability of this value of the statistic occurring is then determined under the assumption. If that value is deemed to be low, the assumption ($H_0$) is rejected.
If we reject the $H_0$ assumption, this does not mean that the assumption we made was guaranteed to be untrue. If it was true and we rejected it because of the low probability of the test statistic under $H_0$, we call it a type I error.
On the other hand, if we accept the assumption this does not mean that our assumption for sure was true. If the assumption was untrue and we accepted it because it had high enough probability under our wrong assumption, this is called type II error.
The statistic is a specific value and it is only if we accept certain assumptions as given that we can assume it follows a specific probability distribution.
This principle holds for all test statistics, not just for the t-statistic you mention here.