Objective function is a function that needs to be optimized (either maximized or minimized) given certain constraints.
In linear regression, you have training data of
m samples and
n features, and the model:
y = w0x0 + w1x1+ ... +wnxn.
The goal is searching for the optimum value of
w0, w1, ...wn so that you expect for given unseen data
X you can accurately predict the value of
y. To reach the goal, you train the model on
m samples. Start with
n random weights, doing iteration to update the weights.
During the iteration, you are doing evaluation to the weights. How? By measuring how close the value of
y obtained from current weights to the actual value of
y. You may pick any formula to define "how close", the most popular is the Mean Squared Error (MSE).
Then the objective is to minimize the MSE function, since smaller error means that
y obtained from current weights are close enough to the actual
So I can say that the goal of the objective function is optimizing weights by minimizing the error.