Properties of the baryon-baryon interactions in the strangeness $S=-2$ sector of chiral effective field theory at the next-to-leading order (NLO) level are explored by calculating $Xi$ single-particle potentials in symmetric nuclear matter. The results are transformed to the $Xi$ potential in finite nuclei by a local-density approximation with convolution by a Gaussian form factor to simulate finite-range effects. The $Xi$ potential is repulsive in a central region, and attractive in a surface area when the $Xi$ energy is low. The attractive pocket can lower the $Xi^-$ $s$ and $p$ atomic states. The obtained binding energies in $^{12}$C and $^{14}$N are found to be conformable with those found in emulsion experiments at Japans National Laboratory for High Energy Physics (KEK). $K^+$ spectra of $(K^-, K^+)$ $Xi$ production inclusive processes on $^9$Be and $^{12}$C are also evaluated, using a semi-classical distorted wave method. The absolute values of the cross section are properly reproduced for $^9$Be, but the peak locates at a lower energy position than that of the experimental data. The calculated spectrum of $^{12}$C should be compared with the forthcoming result from the new experiments recently carried out at KEK with better resolution than before. The comparison would be valuable to improve the understanding of the $Xi N$ interaction, the parametrization of which has still large uncertainties.