These incursions came about because of the Western countries' desire for more trade with Asia. Their consequences were somewhat different in China and Japan.
In China, the incursions led to very unequal treaties being forced upon the Chinese government. These were imposed on them in such events as the Opium Wars. The treaties showed how weak the Chinese government was and helped to lead to its fall and the beginning of the internal Chinese conflict that would end with the communist takeover in 1949.
Japan was a stronger country to begin with and did not suffer from such unequal treaties. In addition, Japan used the contact with the West to modernize rapidly through the Meiji reforms. This modernization led to Japan becoming something close to a first-class world power, one which was strong enough to start imperializing in China on its own.