Tomb of the scholar Qabus, Gurgan, Iran
(built about 1010 AD)
Al Ghazali was born in northern Persia in 1058 AD, under the rule of the Seljuks. His father, who followed Sufism, died when Al Ghazali was still a boy, and one of his father's friends took him and his brother in. When Al Ghazali was twelve years old, he left home to go to a madrassa in a bigger city, Gurgan.
At the madrassa in Gurgan, Al Ghazali studied the works of earlier philosophers, but he was not happy with the answers he found there. Most of the philosophers he studied followed the Neo-Platonist idea that people's souls were all pieces of one universal divine spirit, and they returned to join that divine spirit when you died. But Al-Ghazali wanted ideas based on scientific experiments and proof, not just ideas.
When Al-Ghazali grew up, he eventually (in 1091 AD) became a professor at the sultan's university in Baghdad. Al-Ghazali wrote a book called "On the Incoherence of the Philosophers" that argued against Aristotle and Plato, and against Ibn Sina. Al-Ghazali rejected the Greek philosophers because they were not Muslims. He argued that what looks to us like the laws of nature is really just proof that Allah is a rational god who acts in consistent and reasonable ways. So gravity and inertia are not laws of nature, but laws of God.
In this way, Al-Ghazali was able to do scientific research while still believing in God. He continued his scientific research, and followed the Greek astronomers Thales and Anaxagoras in correctly understanding how solar eclipses and lunar eclipses work. Al-Ghazali also studied mathematics, arguing that math was a different subject from religion, and that you couldn't learn anything about God by doing math, or about math by studying God. Like Lucretius, Al-Ghazali thought that everything in the world was made of tiny atoms, but he thought the atoms were arranged into patterns by God.
But after only four years, Al-Ghazali decided to quit being a professor, give away all his money, leave his family, and live the life of a poor Sufi religious man. As a Sufi beggar, he travelled to Damascus and Jerusalem, and then to Medina and Mecca, before coming home to Tus. Al-Ghazali died in Tus in 1111 AD, when he was 53 years old.
After Al-Ghazali died, the philosopher Ibn Rushd wrote a defence of Aristotle against Al-Ghazali. But despite this effort, Al-Ghazali's work encouraged many later Islamic astronomers to rely on their own observations instead of philosophy to describe the stars and planets.