Different datasets have different underlying structures, while some have linear underlying structures other can have nonlinear structures:
Linear regression is one of the oldest and most fundamental forms of linear modelling, developed/discovered by none other than Carl Fredriech Gauss. Much of modern machine learning is just a beefed up version of linear regression so its worth understanding it well.