We perform 2D Langevin simulations studying the peak effect (PE) of the critical current taking into account the temperature dependence of the competing forces. We observe and report that the PE results from the competition of vortex-vortex interactions and vortex-pin interactions which have different temperature dependencies. The simulations reveal that the PE can take place only for certain pinning strengths, densities of pinning centres, and driving forces, which is in good agreement with experiments. No apparent vortex order-disorder transition is observed across the PE regime. In addition, the PE is a dynamical phenomenon, and thermal fluctuations can speed up the process for the formation of the PE.