The mechanism is indeed a nucleophilic substitution but it does not follow the bimolecular substitution paradigm ($\mathrm{S_N2}$) or the unimolecular one ($\mathrm{S_N1}$) that one learns about in basic organic chemistry classes — and it also does not follow the general electrophilic aromatic substitution that is also often presented in introductory courses.
$\mathrm{S_N2}$ can be ruled out because a rear-side attack would require an attack through the ring — a path which is blocked by the nitrogen atom (and the other bits of the ring).
$\mathrm{S_N1}$ is highly unlikely because we would need a phenyl cation — a highly unstable intermediate.
The aromatic ring of 4-chloropyridine can be understood as electron-deficient since pyridine’s nitrogen exercises a strong $-I$ and $-M$ effect. You can draw the $-M$ effect by pushing the electrons of the $\ce{C=N-C}$ double bond to nitrogen to give $\ce{\overset{+}{C}-\overset{-}{N}-C}$ — and this cation can be moved around the ring, most notably also to the 4-position where chlorine is located. See the figure below.

Figure 1: $-M$ effect of the pyridine nitrogen.
The nucleophilic attack is that of the amino nitrogen’s lone pair into this π system; the attack flips electrons so that the pyridine nitrogen has an additional lone pair, two $\ce{C=C}$ bonds are adjacent to this and a tetrahedral carbon bonded to both $\ce{Cl}$ and $\ce{\overset{+}{N}H2R}$ completes the ring.
This zwitterion can break down by reverse electron flipping which displace the chloride to give the skeleton of the reaction product. Additionally removing a proton from the amino nitrogen gives the neutral product. Considering that we have an acid (2-aminobenzoic acid) in the reaction mixture, I have drawn the pyridine nitrogen (the more basic one) to be protonated throughout the mechanism. This assists in the nucleophilic addition step by further reducing the ring’s electron density. See figure 2 for the mechanism.

Figure 2: Mechanism of the nucleophilic aromatic substitution reaction. Nitrogen being protonated due to the acidic effect of 2-aminobenzoic acid facilitates the reaction.
This mechanism is called nucleophilic aromatic substitution $\mathrm{S_NAr}$ and can only occur on very electron-deficient aromatic compounds: typically pyridines or pyrimidines with additional electron-withdrawing potential leaving groups such as chlorine.