I am aware that Hermes Trismegistus is a combination of the greek god Hermes and the Egyptian god Thoth. But he is credited as the writer of a few books with Asclepius and the Corpus Hermeticum. So in the end was he a historical figure that was promoted to divinity? Or are the books written by other "ghostwriters" and simply credited to him?
He was not a historical person. Those writings were simply credited to Hermes Trismegistus because they were held to be divinely inspired by him.
[The author] gave shape and form to the text, but its substance was of transcendent origin. Those who held Hermes Trismegistus to be the author of a text believed that Hermetic tradition embodied a knowledge inspired by Hermes Trismegistus Himself. There is little reason to doubt that the authors of Hermetic writings were convinced that they were passing down an age-old, divinely inspired knowledge.
- Ebeling, Florian. The Secret History of Hermes Trismegistus: Hermeticism from Ancient to Modern times. Cornell University Press, 2007.
The Hermetica basically takes the form of dialogues involving Hermes Trismgistus. Since the authors believe they were merely recording his words, it would've made easy sense to attribute the works to him as well.