The negative sign is used because F is the restoring force of the spring, which is in the opposite direction from the applied force of the hanging mass.The restoring force is therefore in the opposite direction from the displacement of the spring.
@department of Physics Astronomy