The ecofriendly waterborne alkyd coatings generally compromise the coating performance. Incorporation of polyaniline into alkyd to form nanocomposites can improve the corrosion resistance; however, the uniform distribution of polyaniline (PANI) within the alkyd resin remains a challenge. In this work, PANI is grafted onto epoxy functionalized phosphorylated poly (vinyl alcohol) (PPVA) with different side-chain configurations in order to improve compatibility and dispersion stability. These functionalized PPVA are synthesized using epichlorohydrin (ECIP) or γ-glycidyl methacrylate (GMA) as modifying agents, and respectively labeled as E-PPVA and G-PPVA. G-PPVA/PANI dispersion is stable even at a high PANI loading of 50%, while the maximum PANI loading for E-PPVA/PANI is only 30%. With the incorporation of G-PPVA/PANI into waterborne alkyd resins (AR), the coating resistance is increased by 7 orders of magnitude, and the corrosion inhibition efficiency is up to 99.9%. The coating with the incorporation of G-PPVA/PANI also demonstrates superior long-term corrosion resistance in comparison with that AR/E-PPVA/PANI nanocomposite coating.