This question is complicated, as China has undergone numerous periods of unification and disunion in its long history. In general terms, however, it is fair to say that China first became a unified country in 221 BC, when the Qin Dynasty succeeded in unifying the various warring states.
The process of unifying the various Chinese states had been ongoing for centuries prior to that point, with the Jin Dynasty (1130-1234) and the Shang Dynasty (16th to 11th centuries BC) both making significant progress towards bringing the warring factions together. However, it was during the Qin period that this process was finally completed, with Qin Shi Huang (sometimes referred to as the First Emperor of China) succeeding in creating a single large empire.
Qin Shi Huang managed to do this through a combination of military force and bureaucratic reform. He used military campaigns to put down rebellions in various states, and also created an efficient testing system for government officials that allowed him to appoint people loyal to him to key positions. This helped to unite the disparate states into a single body, creating the first unified Chinese nation.
The Qin Dynasty does not last long, however, with its collapse occurring in 207 BC. This is followed by the Han Dynasty (206 BC to 220 AD), which manages to maintain the unified state created by the Qin. During this period, China expands its territory considerably and advances significantly in terms of science and technology. The Han Dynasty also establishes its authority over the Silk Road and begins to trade extensively with India and the Middle East.
China would remain largely unified until the late 1600s, when it enters a period of disunity known as the Warring States Period. This period lasts until 1911, when the Qing Dynasty is overthrown and the Republic of China is established. Although China experiences some periods of further disunity throughout the 20th century, the country remains largely unified since the establishment of the Republic of China. Today, the People’s Republic of China is the current governing entity of China and continues to hold a strong level of unity and control over the region.