The ASCOT orbit-following code has been equipped with a model for simulating charge exchange (CX) of fast ions with background atoms in magnetically confined fusion plasmas. The model was successfully verified by comparing simulated reaction mean free paths to analytical values across a range of fusion-relevant parameters. ASCOT was used to simulate beam ions slowing down in the presence of CX reactions in a high-density target scenario of MAST-U. ASCOT predicts the total CX-induced loss of beam power to be 22%, which agrees to within 15% with the TRANSP prediction. Because of CX, plasma heating and non-inductive current drive by beam ions are strongly reduced towards the edge. However, an overall lower but noticeable increase of up to 20% in current drive is predicted closer to the core. The simulated wall power deposition from beam ions lost through CX is concentrated around the outer midplane, with estimated peak power loads of 70-80 kWm^2 on the central poloidal field coils (P5) and the vacuum vessel wall between them. This analysis demonstrates that ASCOT can be used to simulate fast ions in fusion plasmas where CX reactions play a significant role, e.g., in spherical tokamaks and stellarators.