According to Monika Piazzesi:
The word “affine term structure model” is often used in different ways. I will use the
word to describe any arbitrage-free model in which [zero coupon] bond yields are affine
(constant plus-linear) functions of some state vector x.
Affine models are thus a special class of term structure models, which write the yield
y(τ) of a τ-period bond as
y(τ) = A(τ) + B(τ) x
for coefficients A(τ) and B(τ) that depend on maturity τ. The functions A(τ) and B(τ)
make these yield equations consistent with each other for different values of τ. The
functions also make the yield equations consistent with the state dynamics.
The main advantage of affine models is tractability. Having tractable solutions for
bond yields is useful because otherwise yields need to be computed with Monte Carlo
methods or solution methods for PDEs. Both approaches are computationally costly,
[...].
The literature on bond pricing starting with Vasicek (1977) and Cox et al. (1985),
therefore has focused on closed-form solutions.The riskless rate in these early
setups was the only state variable in the economy so that all bond yields were
perfectly correlated. A number of extensions of these setups followed both in terms
of the number of state variables and the data-generating processes for these
variables. Duffie and Kan (1996) finally provided a more complete characterization of
models with affine bond yields.
Source: https://web.stanford.edu/~piazzesi/s.pdf
This definition is slightly more general than the above in that $x_t$ (the "state variable") could be a vector rather than a scalar $r_t$ (typically representing the instantaneous risk free rate) used in the earliest models.