From the way I understand this, in C=O the C is delta positive and the O is delta negative due to electronegativity. So, when the C is attacked by the NH3 lone pair, the electrons in C=O move to oxygen to allow the new electrons to form a bond.
The O- pair wants to join the C again to reform the C=O as this will allow further stability of charge. To do this, a pair of electrons will need to be removed from the C to allow this new pair. The Cl will leave because it is most able to accept the pair of electrons (very electronegative), it can also accept a proton (forming HCl) from the NH3+. Because of those 2 things Cl will be the most stable group to leave, Cl- is a weak base, it can accept the proton but can most readily accept the electron pair to be able to leave.
Hope this makes sense