I have done a one-tailed one-sample t-test with the following setup:
$H_0:\overline{x} = \mu = \$151$
$H_A: \overline{x} < \mu $
$n = 24$
For $\alpha = 0.05$, the t-critical value is $-1.711$ (from the t-table, using degrees of freedom $= 24$), and I calculate $\overline{x} = \$126$ (skipping the details of the calculation). I get t-statistic $=-2.5$ so I reject the $H_0$. So far, so good.
Now, the problem asks to calculate the confidence interval using $\alpha = 0.05$.
I know that the margin of error $\overline{x} = \pm t{\text -}critical \times standard \ error$.
The answer to the problem uses the two-tailed t-critical value, which is $2.064$, for $95\%$ confidence interval.
I am confused about why they use the two-tailed t-critical value rather than the one-tailed one?
Is it because calculating the confidence interval is a separate task, and has nothing to do with the original hypothesis, and they are interested to see the deviation from the mean in both directions?
Your use of notation is strange. The hypothesis should be written $$H_0 : \mu = 151 \quad \text{vs.} \quad H_a : \mu < 151.$$ The hypothesis is a statement about the value of the unknown parameter, in this case the mean $\mu$. We make an inference about its value based on the data, from which we calculate a test statistic, which under the null hypothesis is $$T \mid H_0 = \frac{\bar x - 151}{s/\sqrt{n}},$$ where $\bar x$ is the sample mean and $s$ the sample standard deviation. A statistic is never included in the hypothesis because it is something that is calculated from the data; there is no uncertainty about the value we get for it.
Given that $\bar x = 126$ and the value of your test statistic is $T = -2.5$, I get $s \approx 48.9898$ (the exact value of which may differ due to the limited precision you reported for the test statistic).
As for the calculation of a confidence interval, this need not be one-sided even if the hypothesis is one-sided. The two concepts are related, but a confidence interval is nothing more than an interval estimate. So, rather than using the sample mean as a simple point estimate for the true mean, we can incorporate the variability observed in the data to give a more sophisticated estimate of the true mean. You can calculate a two-sided interval or a one-sided interval. The question as stated is not specific about which one is intended.
A two-sided $95\%$ interval is computed as $$\bar x \pm t_{n-1,\alpha/2}^* \frac{s}{\sqrt{n}},$$ where $s/\sqrt{n}$ is the standard error of the mean, and $t_{n-1,\alpha/2}^* $ is the upper $\alpha/2$ quantile of the student $t$ distribution. In your case, it is $$t_{23,0.025}^* = 2.06866.$$ Thus the two-sided interval is $$[105.31, 146.69].$$ The one-sided interval that is in the same direction as the hypothesis test is $$\left(-\infty, \bar x + t_{n-1,\alpha}^* \frac{s}{\sqrt{n}}\right].$$ Here, $t_{23,0.95}^* = 1.71387$ so the upper confidence limit is $143.14$, which is smaller than the upper confidence limit of the two-sided interval. This makes sense because we selected the one-sided upper confidence limit in such a way that the probability the interval does not contain the true mean is $\alpha$; i.e., the upper tail probability of the student $t$ distribution is the full $0.05$, rather than the equal-tailed, two-sided interval.