Charmed tetraquarks Tcc=(ccu¯d¯) and Tcs=(csu¯d¯) are studied through the S-wave meson–meson interactions, D–D, K¯–D, D–D⁎ and K¯–D⁎, on the basis of the (2+1)-flavor lattice QCD simulations with the pion mass mπ≃410, 570 and 700 MeV. For the charm quark, the relativistic heavy quark action is employed to treat its dynamics on the lattice. Using the HAL QCD method, we extract the S-wave potentials in lattice QCD simulations, from which the meson–meson scattering phase shifts are calculated. The phase shifts in the isospin triplet (I=1) channels indicate repulsive interactions, while those in the I=0 channels suggest attraction, growing as mπ decreases. This is particularly prominent in the Tcc(JP=1+,I=0) channel, though neither bound state nor resonance are found in the range mπ=410–700 MeV. We make a qualitative comparison of our results with the phenomenological diquark picture.