Understanding the hysteretic behaviour in fluid–fluid displacement processes in porous media is critical in many engineering applications. In this work, we study the quasi-static immiscible displacement process in two-dimensional porous media during cyclic injections in the context of carbon geosequestration. The role of wettability on the residual trapping of CO $_2$ is investigated numerically using an extended interface tracking algorithm. Despite that higher CO $_2$ saturation can be achieved in CO $_2$ -wet porous media after the first CO $_2$ injection, the majority of CO $_2$ is found to be unstable and can be mobilised during subsequent water injection processes. An improvement in the residual trapping of CO $_2$ is observed as the number of injection cycles increases, which is associated with the dispersion of continuous CO $_2$ ganglia into numerous smaller blobs. Compared with either water-wet or CO $_2$ -wet porous media, it is found that less CO $_2$ is trapped within the neutral-wet ones at equilibrium state after a sufficient number of injection cycles. The hysteretic behaviour of saturation between water/CO $_2$ injection cycles is found to follow an exponential decay, which eventually reaches a finite value. This process corresponds to the shift of the mobile region during displacement from typical capillary fingering to a less ramified regime, which ultimately converges towards main flow channels. This work highlights the hysteretic behaviour during cyclic injections, providing insights on the wettability impacts on multiphase flow in porous media, which is of great importance in applications such as carbon geosequestration and geological hydrogen storage.