An activation function is a mathematical function used in artificial neural networks to determine the output of a neuron. It takes the weighted sum of the input signals and applies a transformation, introducing non-linearity into the model, which is crucial for learning complex patterns.