The Dzyaloshinskii-Moriya (DM) interaction in magnetic models is the result of a combination of superexchange and spin-orbital coupling, and it can give rise to rich phase-transition behavior. In this paper, we study ferromagnetic XY models with the DM interaction on two-dimensional L×L square lattices using a hybrid Monte Carlo algorithm. To match the incommensurability between the resultant spin structure and the lattice due to the DM interaction, a fluctuating boundary condition is adopted. We also define a different kind of order parameter and use finite-size scaling to study the critical properties of this system. We find that a Kosterlitz-Thouless-like phase transition appears in this system and that the phase-transition temperature shifts toward higher temperature with increasing DM interaction strength.