Essentially all learned people have known the earth was a sphere since at least the 300s BCE. The idea that medieval people believed the Earth was flat is a 19th century myth.
There are more responses to this question in the FAQ: https://www.reddit.com/r/AskHistorians/wiki/science#wiki_the_flat_earth_myth