We present the long-term photometric and spectroscopic analysis of a transitioning SN~IIn/Ibn from −10.8 d to 150.7 d post V-band maximum. SN~2021foa shows prominent He {\sc i} lines comparable in strength to the Hα line around peak, placing SN~2021foa between the SN~IIn and SN~Ibn populations. The spectral comparison shows that it resembles the SN~IIn population at pre-maximum, becomes intermediate between SNe~IIn/Ibn and at post-maximum matches with SN~IIn 1996al. The photometric evolution shows a precursor at −50 d and a light curve shoulder around 17d. The peak luminosity and color evolution of SN 2021foa are consistent with most SNe~IIn and Ibn in our comparison sample. SN~2021foa shows the unique case of a SN~IIn where the narrow P-Cygni in Hα becomes prominent at 7.2 days. The Hα profile consists of a narrow (500 -- 1200 km s−1) component, intermediate width (3000 -- 8000 km s−1) and broad component in absorption. Temporal evolution of the Hα profile favours a disk-like CSM geometry. Hydrodynamical modelling of the lightcurve well reproduces a two-component CSM structure with different densities (ρ∝ r−2 -- ρ∝ r−5), mass-loss rates (10−3 -- 10−1 M⊙ yr−1) assuming a wind velocity of 1000 km s−1 and having a CSM mass of 0.18 M⊙. The overall evolution indicates that SN~2021foa most likely originated from a LBV star transitioning to a WR star with the mass-loss rate increasing in the period from 5 to 0.5 years before the explosion or it could be due to a binary interaction.