KCN is a salt of a strong base and weak acid. It undergoes hydrolysis when dissolved in water to form weak acid HCN and strong base KOH.
HCN is a weak acid because it gives less H+ ions in the solution while KOH is strong electrolyte and remains completely dissociated. Therefore, the resulting solution contains more OH– ions and it is therefore alkaline.