In pre-modern times, most ordinary Chinese worshipped a variety of gods, each of whom had limited powers. In the case of China's intellectuals, whether they adhered to philosophical Daoism (or Taoism, to be distinguished from the religion of Daoism) or neo-Confucianism, "the supernatural [was] conceived of as an essence or principle governing life...that is impersonal, remote, and definitely not a being" (Rodney Stark, The Victory of Reason: How Christianity Led to Freedom, Capitalism, and Western Success, p. 16). In short, the Chinese lacked a belief in a single, all-powerful, personal Creator who established the laws that regulate the functioning of the universe--laws that could discovered through scientific inquiry. To quote historian of science Thomas Needham, the failure of the Chinese to develop modern science was because "the conception of a divine celestial lawgiver imposing ordinances on non-human Nature never developed" (as quoted by Stark, p. 17). For the Chinese, "it was not that there was no order in Nature...but rather that it was not an order ordained by a rational, personal being, and hence there was no conviction that rational personal beings would be able to spell out in their lesser earthly languages the divine code of laws which he had decreed aforetime" (Needham, as quoted by Stark, p. 17).
Recently, I discovered another possible reason why the Chinese did not develop modern science. In a volume I received many years ago as a gift, Chinese Thought and Institutions, edited by famed American Sinologist John K. Fairbank, appears a chapter titled "The Political Function of Astronomy and Astronomers in Han China," by China scholar Wolfram Eberhard. In this chapter Eberhard explores the political role of astronomy in China during the Former Han Dynasty (206 BC-8 AD). It might seem strange to talk about a political role for astronomy, so let me explain. At a fairly early date in their history, the Chinese developed the idea that the emperor was given his right to rule by Tian ("Heaven"), the name given to the impersonal moral force that governed the universe (although, arguably, Tian was originally viewed as a personal, monotheistic deity like in Judaism or Christianity). In other words, a legitimate emperor possessed the so-called Mandate of Heaven (Tianming). However, the emperor could lose the Mandate of Heaven if he acted in unjust or immoral manner, and thus lose his throne. To warn the emperor that he was acting contrary to its will, Heaven might cause omens or portents to occur, including such celestial phenomena as eclipses and planetary conjunctions. Thus, astronomers in ancient China served a political function by interpreting the meaning of these celestial phenomena. Astronomers also played a political role due to their role in creating a calendar for the ruling dynasty. The calendars created by these astronomers were not mainly intended to keep track of time or to even to help farmers know the appropriate time for planting crops. Rather, these calendars were intended to "[express] the magical powers which the dynasty represented " (Eberhard, p. 66) through the incorporation of certain numbers with mystical significance.
This political role for astronomy in ancient China created another roadblock to the development of science. Viewing celestial events as having a political significance discouraged astronomers from analyzing them as natural phenomena. As Eberhard points out, "it is quite obvious that the specialists [i.e., astronomers] were interested only in the political application of their observations and not in philosophical reasoning or scientific abstractions" (p. 69). Neither did astronomers have any reason to use their "body of solid scientific knowledge" (Eberhard, p. 66) to create an improved, more accurate calendar as "improvement of calendars was regarded as a revolutionary act [as it implied the onset of a new dynasty] and was punished" (Eberhard, p. 66). In other words, "new ideas were conceived as new tools for...political struggle and therefore suspect. Science, therefore, was hampered in its development" (Eberhard, p. 67).
To conclude, it would appear that pre-modern China, despite its many cultural achievements, did not develop modern science due to at least two reasons. First, it lacked the philosophical/theological assumptions required for developing a scientific outlook. Second, political considerations hampered the development of an objective understanding of natural phenomena. Instead, it was in the West, due (at least in part) to the influence of Christian theology and a lack of politically-imposed restrictions, that modern science began to emerge.
Image of ancient observatory in Beijing, China from Wikimedia Commons