Because a well trained detection dog is better. End of story. Maybe someday a machine will be able to do what dogs can. People are working really hard on this problem, especially for remote detection (like, there's a bomb over there because my laser can see it's smell in the air). The odor signature (i.e. GCMS plot) of heroin or C4 is a pretty complicated thing. Does your machine have 1000 chemical sensors integrated with a brain that also controls the motion, sniffing, and rapid response coupling those features? No, not yet? Maybe someday.
[
https://www.degruyter.com/document/doi/10.1515/cclm-2019-1269/html?lang=en]
I tell my students if they want to get an impression of the dog's umwelt consider switching your visual acuity and processing with your sense of smell. That is the dog's world; smell first, vision second (sort of).
The big problem with detection dogs is that it isn't scalable. You need good well trained dogs and a handler that won't screw it up. That's expensive to actually do. There won't be a factory in Shenzhen turning out 1000 dog teams per day. That's mostly why people want to build machines to do it.
One of my favorite quotes here, which I can only paraphrase (sorry Ken) is "The great thing about detection dogs is they are incredibly sensitive (olfaction-wise), intelligent, and highly trainable. One of the worst things about detection dogs is they are incredibly sensitive (olfaction-wise), intelligent, and highly trainable." - Ken Furton, FIU. You'd understand this if you ever saw a poorly trained detection dog. There is some skill required to train them.
* Fun, but useless, fact: Drug dogs can't smell cocaine, it's an anesthetic that shuts down those receptors. If you are busted by a drug dog for cocaine, it's because they smelled the chemical breakdown products (methyl benzoate primarily and other stuff). The best dogs are trained not to respond to just methyl benzoate, it must be methyl benzoate and the other stuff.