Water can out out a fire because it is able to take away oxygen. A fire needs oxygen and heat in order to burn. Water also is able to cool the fire. but it does not able in case of high gases like helium ,tritrium, deutron etc
Sometimes water is not an alternative for extinguishing fire in cases like petrol fire or electric fire because in petrol fire,when we pour water it will not extinguish the fire as petrol is lighter then water it will float over water and keep burning, in case of electric fire if you put water you could get an electric shock because water is a conductor of electricity. In such cases, fire extinguishers are used.