The main reason is simply for teaching purposes: Assuming fixed explanatory variables ensures that the error term is independent of the (deterministic) variables, $E(u|X) = 0$ holds by definition, see also here. Sometimes you started with fixed / deterministic explanatory variables in a first undergraduate course to explain the basic ideas and algebra. Then proceed with stochastic variables to make clear that in the real world correlation and causality are not always the same.
Wooldridge describes this in his (advanced) textbook Econometric Analysis of Cross Section and Panel Data as follows:
In a first course in econometrics, the method of ordinary least squares (OLS) and
its extensions are usually learned under the fixed regressor assumption. This is appropriate for understanding the mechanics of least squares and for gaining experience
with statistical derivations. Unfortunately, reliance on fixed regressors or, more generally, fixed ‘‘exogenous’’ variables, can have unintended consequences, especially in
more advanced settings. [...] This is not just a technical point: estimation methods that are consistent under the fixed regressor assumption, such as generalized least squares, are no longer consistent when the fixed
regressor assumption is relaxed in interesting ways.