Is it common for apartments to have shared extractor ducts? I've never heard of a setup like this before, and it sounds like both a pain in the arse and a potential safety issue.
Controlling the kitchen fan is probably the easier bit. Depending on the design of the hood, you might be able to control it with a smart outlet or relay. Turn the hood's switch to always on and control it with the relay. The difficult bit would be sensing when to turn it on.
Cooking will often produce VOCs, and VOC sensors are easy to obtain, but they are also have other sources that are likely in your own apartment. Maybe try using temperature and humidity sensors int the duct to activate the fan when there is elevated temperature and humidity inside the duct?