  We study bottom quark energy loss via the nuclear modification factor
($R_\mathrm{AA}$) and elliptic flow ($v_2$) of non-prompt $D^0$ and $J/\psi$ in
relativistic heavy-ion collisions at the LHC. The space-time profile of
quark-gluon plasma is obtained from the CLVisc hydrodynamics simulation, the
dynamical evolution of heavy quarks inside the color deconfined QCD medium is
simulated using a linear Boltzmann transport model that combines Yukawa and
string potentials of heavy-quark-medium interactions, the hadronization of
heavy quarks is performed using a hybrid coalescence-fragmentation model, and
the decay of $B$ mesons is simulated via PYTHIA. Using this numerical
framework, we calculate the transverse momentum ($p_\mathrm{T}$) dependent
$R_\mathrm{AA}$ and $v_2$ of direct $D$ mesons, $B$ mesons, and non-prompt
$D^0$ and $J/\psi$ from $B$ meson decay in Pb+Pb collisions at
$\sqrt{s_\mathrm{NN}}=5.02$ TeV. We find the mass hierarchy of the nuclear
modification of prompt $D$ and $B$ mesons depends on their $p_\mathrm{T}$. Both
$R_\mathrm{AA}$ and $v_2$ of heavy flavor particles show strong $p_\mathrm{T}$
and centrality dependences due to the interplay between parton energy loss,
medium geometry and flow, and hadronization of heavy quarks. Non-prompt $D^0$
and $J/\psi$ share similar patterns of $R_\mathrm{AA}$ and $v_2$ to $B$ mesons
except for a $p_\mathrm{T}$ shift during the decay processes. Therefore, future
more precise measurements on non-prompt $D^0$ and $J/\psi$ can help further pin
down the bottom quark dynamics inside the quark-gluon plasma.
