KCN reacts with an alkyl halide in a direct SN reaction to give the product. So it could be SN2 or SN1.
AgCN is special, in that Ag has a special high affinity for halogens. It will automatically abstract the halogen and form a precipitate, leaving a carbocation and a CN- ion. The reaction path followed is always SN1 because the formation of precipitate shifts equilibrium of formation far forward. The carbocation formed is irrespective of its stability.
As per Hard Soft Acid Base theory, a hard acid carbocation will like to bond with a hard base nitrogen. Thus resonance in CN anion takes place and NC- attacks the carbocation, forming an isocyanide.
Thus a cyanide ion is called an ambident nucleophile, as it can attack from more than one nucleophilic centers.