If the counterweight were not there, the load would tend to tip the crane forwards [clockwise]. The counterweight, which is usually made of a dense material such as concrete or lead, provides an anticlockwise moment that balances the load on the crane.
What's more: When the load is lifted, the counterweight is lowered. This reduces the amount of work done.
A counterweight is also used in many rotating systems to reduce vibrations due to imbalances in the rotating assembly. A typical example is counterweights on crankshafts in piston engines.