A study of prompt and non-prompt mathrm {J}/psi production as a function of charged-particle multiplicity in inelastic proton–proton (pp) collisions at a centre-of-mass energy of sqrt{s} = 13 TeV based on calculations using the PYTHIA8 Monte Carlo is reported. Recent experimental data shows an intriguing stronger-than-linear increase of the self-normalized mathrm {J}/psi yield with multiplicity; several models, based on initial or final state effects, have been able to describe the observed behaviour. In this paper, the microscopic reasons for this behaviour, like the role of multiple parton interactions, colour reconnections and auto-correlations are investigated. It is observed that the stronger-than-linear increase and the transverse momentum (p_mathrm {T}) dependence, contrary to what is predicted by the other available models, can be attributed to auto-correlation effects only. In absence of auto-correlation effects, the increase of the yield of mathrm {J}/psi with multiplicity – and in general for all hard processes – is weaker than linear for multiplicities exceeding about three times the mean multiplicity. The possibility of disentangling auto-correlation effects from other physical phenomena by measuring the charged-particle multiplicity in different pseudo-rapidity and azimuthal regions relative to the mathrm {J}/psi direction is investigated. In this regard, it is suggested to extend the experimental measurements of mathrm {J}/psi production as a function of the charged-particle multiplicity by determining the multiplicity in several azimuthal regions and in particular in the Transverse region with respect to the direction of the mathrm {J}/psi meson.