Thrust comes from a momentum balance, involving all the fluid influenced by the engine.
From a very simple model, thrust is approximately equal to the product of the mass flow $\dot m$ and the difference between the component in the direction of motion of the outflow velocity $V_2$ and the inflow velocity $V_1$,
$T = \dot m (V_2 - V_1)$.
An engine in normal regime accelerates the fluid, so that $V_2 > V_1$ and thus $T> 0$.
Thrust reversers deflect (some of) the outflow to reduce (or reverse, when $V_2<0$) the outflow velocity so that $V_2 < V_1$ and thus it generates a force $T<0$, that makes the aircraft decelerate.