The transverse momentum (pT) and centrality dependence of the nuclear modification factor RAA of prompt and non-prompt J/ψ, the latter originating from the weak decays of beauty hadrons, have been measured by the ALICE collaboration in Pb–Pb collisions at $$ \sqrt{s_{\textrm{NN}}} $$
s
NN
= 5.02 TeV. The measurements are carried out through the e+e− decay channel at midrapidity (|y| < 0.9) in the transverse momentum region 1.5 < pT < 10 GeV/c. Both prompt and non-prompt J/ψ measurements indicate a significant suppression for pT > 5 GeV/c, which becomes stronger with increasing collision centrality. The results are consistent with similar LHC measurements in the overlapping pT intervals, and cover the kinematic region down to pT = 1.5 GeV/c at midrapidity, not accessible by other LHC experiments. The suppression of prompt J/ψ in central and semicentral collisions exhibits a decreasing trend towards lower transverse momentum, described within uncertainties by models implementing J/ψ production from recombination of c and $$ \overline{\textrm{c}} $$
c
¯
quarks produced independently in different partonic scatterings. At high transverse momentum, transport models including quarkonium dissociation are able to describe the suppression for prompt J/ψ. For non-prompt J/ψ, the suppression predicted by models including both collisional and radiative processes for the computation of the beauty-quark energy loss inside the quark-gluon plasma is consistent with measurements within uncertainties.