Dear student
The negative sign indicates that 'F' is a restoring force.
Since F and x both are vector quantities, the negative sign shows that the force is always acting in the direction opposite to the displacement.
It is by convention, in order to make k positive quantity, a negative sign was introduced.
Regards.