  We propose a new physics model which has a cold dark matter candidate and can
explain the $b \to s \mu^+\mu^-$ anomaly at the same time. Our model includes a
scalar quark $\widetilde{q}$ and a scalar lepton $\widetilde{\ell}$ which are
$SU(2)_L$-doublet as well as a Dirac fermion $N$ which is $SU(2)_L$-singlet.
The new particles are charged under a gauged $U(1)_X$ group which is
spontaneously broken to a discrete $Z_2$ symmetry by a dark scalar $S$. The
remnant $Z_2$ symmetry stabilizes the dark matter. Box diagrams with
$\widetilde{q}$, $\widetilde{\ell}$, and $N$ running inside the loop can
generate the correct Wilson coefficients $C_9^\mu = -C_{10}^\mu$ to accommodate
the $b \to s \mu^+\mu^-$ anomaly while avoiding constraints such as
$B_s-\overline{B}_s$ mixing. The dark matter annihilation into a second
generation lepton pair via $t$-channel $\widetilde{\ell}$-exchanging process
plays an important role in producing the current dark matter relic abundance of
the universe, showing a strong interplay between the flavor and dark matter
physics. We also discuss dark-gauge-interaction-dominated and
Higgs-portal-dominated scenarios for dark matter physics.
