The reaction mechanism consists of two nucleophilic substitutions: the amine is the first nucleophile displacing the bromine atom which then acts as the second nucleophile. In following the mechanism is described using trimethylamine as example:
First, the trimethylamine reacts with the cyanogen bromide to form a quaternary ammonium salt, which in the next step reacts by splitting off bromomethane to give the dimethylcyanamide. This is a second-order nucleophilic substitution (S2).