Underfitting occurs when a machine learning model is too simple to capture the underlying patterns in the data, resulting in poor performance on both the training and test datasets. It is often a result of overly simplistic models or insufficient training, leading to high bias and low variance in predictions.