Visiting the grave of a polytheist is permissible only for the sake of taking a lesson
The Prophet ﷺ was given permission to visit the grave of his mother.
Reference: Tirmidhi: 1054, Kitab al-Janaiz: Bab ma ja’a fi al-rukhsa fi ziyarat al-qubur, Muslim: 977, Abu Dawud: 3235
(Nawawi, may Allah have mercy on him) This hadith shows that visiting the graves of polytheists is permissible.
Reference: Ahkam al-Janaiz: p. 239