(a) Ammonia acts as a ligand. Its nitrogen lone pair bonds to Ag+, forming a soluble complex ion, so the solid dissolves:
AgCl(s)+2NH3(aq)→[Ag(NH3)2]+(aq)+Cl−(aq)
The complex ion is diamminesilver(I) ion (two ammine ligands; silver in the +1 state; the entity is a cation, so the metal keeps the name "silver").
(b) Nitric acid supplies H+ ions, which combine with the ammonia to give ammonium ions:
NH3+H+→NH4+
The nitrogen lone pair is now used in the N–H bond, so NH4+ has no lone pair to donate and cannot act as a ligand. The ammine ligands are removed from silver, the complex breaks down, and the free Ag+ and Cl− ions precipitate again as AgCl:
[Ag(NH3)2]++Cl−+2H+→AgCl(s)+2NH4+
The reappearance of the white precipitate confirms that it was silver chloride.