Many Chinese leaders in the time of Confucius were making poor decisions causing the economy to fail and collapse. Leaders were no behaving how they should and Confucius wanted to change that.
Confucius began to think of a way to explain how others should behave but never wrote down definitive notes on his philosophy he created that though other a way that they should behave unlike most philosophies or religions he created no overarching god or gods.
Confucius went on to create the 5 constants which is a social hierarchy in sense showing the bonds between certain people. The constants are ruler to ruled, father to son, husband to wife, elder brother to younger brother, and then the only constant that is equal, friend to friend. He also created the Analects which is a collection of teachings of Confucius. The Analects are what are studied in Chinese civil service exams.
Confucius began teaching his philosophy to people in China and some ruler adopted his teachings as well. His philosophy was starting to become very popular among the people of China.
Confucius philosophy helped unify China and create strong leaders and well behaved leaders and people. China grew stronger because of this and flourished
When Confucius died his philosophy became the official philosophy of China and helped China be a great nation for many years forward some even follow it today.