Just wanting to add a source to what said @Shalom said: the Tiferet Lemoshe from the Maharts Hayes, Chapter 1, explain the importance of knowing history,especially especially that of Israel. He asked then why then did the RamBaM wroteRambam write what he did,did; that read Chronicles of Arabs, their Politics and genealogies, is waste of time, and. He answered that those were impossible stories and also eroticalerotic ones (Agavim ?).