The first person ever to write a narrative historical account is Herodotos of Halikarnassos (c. 480-425 BC). He was a Greek who grew up on the western fringe of the Persian Empire, was exiled to Samos, then moved to Athens, then moved to Southern Italy to found the settlement of Thourioi. Inspired by the chronicler Hekataios of Miletos and the natural philosophers of the Greek cities on the coast of Asia Minor, he decided to write about his "investigations" (Greek: historiê) into the history and peoples of the world, and in particular, about the Persian Wars.
We don't quite know where the idea of writing history as such (i.e. the amalgamated narrative account of the development of humans and their organisations over time) came from. Herodotos' work is still heavily informed by the forms of genres that already existed at his time, like epic poetry and medical texts. However, he makes it clear that he is drawing on the existing oral traditions of many venerable institutions (noble families, religious centres), showing that an interest in preserving the past (or a particular version of it) was already widespread in his day.
While Herodotos is sometimes called the Father of History, many people consider his attempt to define this new genre greatly lacking. A lot of it is ehtnography; a lot of it is hearsay; a lot of it is fantastical. The second known historian, Thucydides (c. 460-395 BC) is sometimes regarded as the first "scientific" historian; his history, of the Peloponnesian War between Athens and Sparta, is much more focused, with a keen interest in human action and rational explanation.