Beginning from their production to their detection, heavy quarks like charm and bottom participate in every stage of the heavy ion collision process due to their significant masses. Each phase of the hadronic collision profoundly influences both the kinematics and dynamics of heavy quarks. Our research focuses on investigating the dynamics of heavy flavors by examining azimuthal angular correlations of open heavy flavors. In proton-proton collisions, azimuthal angular correlation provides insights into the production and fragmentation of heavy quarks, while in heavy-ion collision studies, it allows us to explore modifications in azimuthal correlation due to initial state effects (such as Glasma, CGC, CNM) and final state effects (such as QGP, fragmentation). Using ALICE run-3 data, we are measuring azimuthal angular correlation of heavy flavor with charged particles in proton-proton collisions. The precise measurement of this correlation is crucial for distinguishing between various fragmentation models. Furthermore, our investigation of Pb-Pb collisions involves examining the impact of nuclear PDFs on the azimuthal correlation of D-Dbar and B-Bbar pairs. A differential analysis of these correlations can aid in understanding the extent of thermalization of heavy flavors within the Quark-Gluon Plasma (QGP) medium.