Why are there different types of fire extinguishers?

There are different types of fires which are classified by the type of flammable material or hazard they present. Different types of flammable material and fires require different extinguishing agents to effectively extinguish the fire:

Classes of fire: 

CLASS A: Fires in ordinary combustible materials such as wood, cloth, paper, rubber, and many plastics.
CLASS B: Fires in flammable or combustible liquids, such as oils, greases, tars, oil base paints, lacquers, and flammable gases.
CLASS C: Fires involving energized electrical equipment when electrical non-conductivity of the extinguishing media is of importance.
CLASS D: Fires in combustible metals, such as magnesium, titanium, sodium, lithium, and potassium.
CLASS K: Fires in cooking appliances that involve combustible cooking media (vegetable or animal oils and fats).

Fire Protection Rating.
The classification of extinguishers shall consist of a LETTER which indicates the class of fire on which an extinguisher has been found to be effective, preceded by a rating NUMBER (Class A and B only) which indicates the relative extinguishing effectiveness such as 2:A-10:BC.

EXCEPTION: Extinguishers classified for use on Class C, Class D, or Class K hazards shall not be required to have a number preceding the classification letter.