The cost index is a number used in the Flight Management System (FMS) to optimize the aircraft's speed. It gives the ratio between the unit cost of time and the unit cost of fuel.
With this number, and knowledge about the aircraft's performance, it is possible to calculate the optimal speed for the aircraft, which results in the lowest total cost.
Speeds slower than the optimal speed will result in less fuel burn, but also in more flying time. The cost of the extra flying time outweighs the fuel savings at speeds below the optimum speed.
Speeds faster than the optimal speed will result in more fuel burn, but also in less flying time. The saving of less flight time do not outweigh the fuel burn at speeds above the optimum speed.
A low cost index means that the cost of time is low or that fuel is expensive. It will result in a low speed. High cost index means high cost of time (e.g. passengers about to miss their flight connection) or low fuel price (rare these days).
At the minimum cost index (0) only fuel counts. This will result in the aircraft flying at Maximum Range Cruise. At the maximum cost index only time counts. This will result in the aircraft flying at Maximum Cruise Speed (Vmo / Mmo with a buffer)
Airlines generally have a standard cost index they use for planning and adjust them on a flight by flight basis.
This document from Airbus explains the cost index in more detail.