Following a previous experimental study of the noise generated by cylindrical cavities placed in subsonic flows, this work investigates mechanisms involved in the noise generation by a cylindrical cavity placed in a turbulent boundary layer, via numerical simulation. The cavity has a radius of r =5 cm and a depth of 10 cm. Flows are computed at Mach numbers of 0.2, 0.26 and 0.32, and the numerical boundary layer, of thickness 17 mm, is perturbed upstream of the cavity. Simulations are performed by solving the unsteady compressible Navier-Stokes equations using low-dispersion and low-dissipation finite-difference schemes. The LES approach is based on the explicit application of a selective filtering to the flow variables to take into account the dissipative effects of the subgrid scales. Numerical results are compared to the available experimental data presented in previous work, including mean flow aspects, flow statistics and acoustics. The numerical results are then examined in more detail in particular with regard to the origin of the well-defined tones observed in the acoustic far field. A simple feedback model coupling shear layer dynamics with depth mode acoustic resonance is shown to yield good frequency predictions.