This is covered in an earlier scene in the film's official novelisation. Palpatine claims that because the Jedi keep going on about the Sith, that he's been spending some time reading up on his history and has become quite the afficianado of Sith myths and legends. When he mentions the story of Darth Plagueis, Anakin is surprised to be hearing it, but doesn't immediately put 1+1 together, largely because he's
a thicko distracted by worry about Padmé.
“The Sith are the definition of evil-“
“Or so you have been trained to believe. I have been reading about the
history of the Sith for some years now, Anakin. Ever since the Council
saw fit to finally reveal to me their … assertion … that these
millennium-dead sorcerers had supposedly sprung back to life. Not
every tale about them is sequestered in your conveniently secret
Temple archives. From what I have read, they were not so different
from Jedi; seeking power, to be sure, but so does your Council.” “The
Anakin's later surprise was not that Palpatine knew about the mythos of the dark side of the Force, but that Palpatine was actually a dark Force practitioner, something that took him completely by surprise.
Note that the scene above doesn't appear in the film which makes this a "legend", rather than part of the official Disney canon.