The elliptic flow of prompt and non-prompt $$J/\psi $$ was measured in the dimuon decay channel in Pb+Pb collisions at $$\sqrt{s_{_\text {NN}}}=5.02$$ $$\text {TeV}$$ with an integrated luminosity of $$0.42~\mathrm {nb}^{-1}$$ with the ATLAS detector at the LHC. The prompt and non-prompt signals are separated using a two-dimensional simultaneous fit of the invariant mass and pseudo-proper decay time of the dimuon system from the $$J/\psi $$ decay. The measurement is performed in the kinematic range of dimuon transverse momentum and rapidity $$9<p_\mathrm {T}<30$$ $$\text {GeV}$$ , $$|y|<2$$ , and 0–60% collision centrality. The elliptic flow coefficient, $$v_2$$ , is evaluated relative to the event plane and the results are presented as a function of transverse momentum, rapidity and centrality. It is found that prompt and non-prompt $$J/\psi $$ mesons have non-zero elliptic flow. Prompt $$J/\psi $$ $$v_2$$ decreases as a function of $$p_\mathrm {T}$$ , while for non-prompt $$J/\psi $$ it is, with limited statistical significance, consistent with a flat behaviour over the studied kinematic region. There is no observed dependence on rapidity or centrality.