Underfitting happens when an algorithm isn't complex enough to properly capture the underlying relationships and patterns in the data. This is the opposite problem to overfitting.
The following is an example of an algorithm that generated an underfit function to the training data and a properly fit function
Underfit Function
Properly Fit Function