These are the double displacement reactions.
The double displacement reactions mean the exchange of cations and anions to form some different compounds which are more stable energetically than the previous ones.
Here the participating ions on the reaction are sodium, chloride, silver and nitrate ions. Now the sodium was with chloride amd silver was with nitrate. But the reaction made the product silver chloride which precipitated out and stabilized the system, forming sodium nitrate as the product.