Hong Kong and China are one country. However, in practice and for all practical purposes they remain separate, meaning a China Visa application in Hong Kong is easy if not simple.
Hong Kong and China have separate currencies, the Yuan for China and the Hong Kong Dollar, these are only usable in their respective territories. Most importantly, entry into Hong Kong doesn't win you entry into China. See below for information on China visa application in Hong Kong and entry onto the Chinese mainland. Hong Kong is referred to as a SAR (Special Administrative Region), whereas China is referred to as the mainland.
Getting a Visa for China in Hong Kong
The short answer, however, is yes, you can get a Chinese visa in Hong Kong. Alternatively, if you just want a quick peek at China, some nationalities can get a Shenzhen visa, which is specific to that city.
Traveling Straight to China From Hong Kong Airport
If you are transiting to a flight into China, you won't have to pass through Hong Kong immigration. Dragon Air and China Air offer a selection of flights to most Chinese cities. You can also travel directly to Shekou in Shenzhen from the airport by bonded ferry if you fly on selected airlines. This option requires you only to clear Chinese immigration in Hong Kong airport. However, you will need a Chinese visa in advance as you cannot obtain one at Hong Kong airport. There is also a selection of buses at the airport that travels directly to various Southern Chinese cities; however, they require you to pass through Hong Kong immigration first.
The Most Commons Way of Traveling from Hong Kong to China
Apart from the bonded ferries and flights mentioned above, the most common form of travel onto the mainland is by train. If you simply want a taste of China, you can actually take the MTR all the way to Shenzhen from Tsim Sha Tsui Station. Those going to Guangzhou can take advantage of a regular and quality train service. Trains leave hourly, take about 2 hours and cost roughly $25. A daily overnight train to Beijing and Shanghai, costing around $100-$150 is available. All trains leave from Hung Hom KCR Station, and tickets can be bought at the station.
Booking Hotels and Transportation
Hong Kong travel agents are licensed to book hotels and onward transportation on the mainland - you'll find your hotel will probably offer this option also. A number of agents also have stores at the airport; however, these are after immigration, so if you're transiting you won't be able to use them. The advantage of booking in Hong Kong is that it will be more straightforward than on the mainland but the cost will be a premium.
Hong Kong speaks Cantonese while the majority of speakers on the mainland use Mandarin, these languages are not interchangeable. Cantonese is also spoken in the southern parts of China, such as Guangdong and Shenzhen, but Mandarin is becoming increasingly popular. Mandarin is the Lingua Franca for the rest of the country.