America
American Supreme Court judges are selected by whichever political faction controls the presidency, with Presidents choosing these judges based on judges' political leanings (Democrat Presidents recruit 'liberal judges', Republican Presidents recruit 'conservative judges').
This means that American law is essentially a to-and-fro between the two ideological factions of its ruling party. As the conservatives gain influence, the nation's laws and courts become more conservative. As the liberals gain influence, the nation's law-making becomes more liberal. See today's ruling on the President's ban on transgender military service people, in which Supreme Court judges voted 100% in allegiance with their party factions' positions on the ban:
The United States Supreme Court has allowed President Donald Trump to enforce his policy of banning certain transgender people from the military.
The court voted 5-4 to grant a Trump administration request to lift injunctions blocking the policy while challenges continue in lower courts.
The four liberal judges on the court opposed the ruling.
China
The judicial system is broadly the same in the world's other superpower: China. In China, judges of the Supreme People's Court are selected by the Standing Committee of the National People's Congress (the Chinese equivalent of the US Executive Branch, or UK's Cabinet). The Standing Committee, and wider People's Congress, similarly see shifts in the influence of the Congress' two main factions: the neo-liberals and the populists, which the direction of the nation's legal system and rulings shift in step with.
The slight difference, however, is that judges are picked generally based on their track record of adherence to Party leadership. Rather than making rulings along the lines of their own ideological bent, they are instead more likely to make rulings in accordance with the prevailing ideological doctrine within the wider Party.
This means that while the US legal rulings are fixed along the ideological lines of previous Presidents' political leanings, the rulings of the Chinese system instead shift more regularly as the factional control of the government shifts.
Summary
America and China have very similar legal systems, influenced by their main political factions. The main difference is that while America's system is set up in such a way that the two political factions are able to endlessly gridlock and obstruct each other (e.g. its government has been in shutdown for the past month due to factional infighting), China's system enables the dominant faction to exercise more complete control and maintain direction and trajectory.