You are right that both NaCl and AgNO3 are stable. They will form soluble ions of Na+ and Cl- from NaCl and Ag+ and NO3- from AgNO3. However, when the chloride ion meet the silver ion, since they will form a salt with very low solubility (insoluble). So, white precipitate will be formed. This reaction is called precipitation reaction. It is a very important step in purification of silver.