An activation function introduces nonlinearity into a neural network, applied after each layer's linear transformation specifically so that stacking multiple layers together produces a genuinely more expressive function than a single linear layer could, since stacking purely linear transformations without any nonlinearity in between collapses algebraically into one equivalent linear transformation regardless of how many layers are stacked. The specific activation function chosen, ReLU, GELU, Swish, or a gated variant like SwiGLU, affects training dynamics and final model quality differently, which is why activation function choice remains an actively studied architectural decision rather than a solved, interchangeable detail.