From the Super Mario Wiki
A kannon is an object found in Donkey Kong Country 2: Diddy's Kong Quest. To activate a kannon, Diddy and Dixie Kong must throw a kannonball into it, and then enter it; it launches the Kongs to a Bonus Area. They first appear in Mainbrace Mayhem, and only appear in levels with kannonballs (not being shot). There is also a Kremling enemy named Kannon, whose name is based on the kannon it carries around.
A single kannon appears in Donkey Kong 64 in the Gloomy Galleon stage. To use it, Chunky Kong must put a kannonball into it. He must use the kannon to fire kannonballs at moving targets on the wall. By firing at enough of them, Chunky is awarded with a Golden Banana.