Heavy quarks have been adopted as a hard probe for the QGP properties for a long time. Recent data from both RHIC and SPS experiments reveal surprisingly large values of the elliptic flow v2 and surprisingly small values of the nuclear modification factor RAA exhibited by D mesons, indicating a much stronger interaction between charm quarks and the medium than we expected. Therefore, it is of great interest to study the dynamics of heavy quarks in an expanding QGP medium and verify whether they indeed approach equilibrium on a timescale on the order of the lifetime of QGP. In this talk, we will firstly provide a brief introduction to RHIC physics. And then introduce the main results of our recent research on the thermalization process of charm quarks in infinite and finite QGP matter in the framework of Langevin algorithm.