  Heavy-flavor jets are powerful tools to gain insight into the in-medium
partonic energy-loss mechanisms and the quark-gluon plasma's (QGP) transport
properties in high-energy nuclear collisions. In this work we present the first
theoretical study of the longitudinal momentum fraction $z_{||}$ carried by
heavy-flavor mesons in jets in Pb+Pb collisions at $\sqrt{s_{\rm NN}}$ = 5.02
TeV. The p+p baseline is provided by POWHEG+PYTHIA8, which matches the
next-to-leading-order hard processes with the parton shower. We employ a Monte
Carlo transport model, which considers the collisional and radiative partonic
energy loss, to simulate the evolution of heavy-flavor jets in the expanding
QGP medium. We observe steeper $z_{||}$ distributions of $\rm{B^0}$ jets
compared to those of $\rm{D^0}$ jets at the same kinematics region in p+p
collisions, which may be a hint of the harder jet fragmentation function of b
jets compared to c jets in vacuum. In A+A collisions, it is shown that the jet
quenching effect would generally decrease the values of $z_{||}$. We have made
a systematical study on how several factors, including jet $p_{\rm{T}}$, jet
radius $R$, and collision centrality, would influence the medium modification
of $z_{||}$ distributions of a $\rm{D^0}$ jet. In addition, we predict visibly
stronger nuclear modifications of $\rm{B^0}$-jet $z_{||}$ distributions
compared to a $\rm{D^0}$ jet within the same $p_{\rm T}$ windows as a result of
the much steeper initial $z_{||}$ distribution of the $\rm{B^0}$ jet in vacuum.
