Though Hong Kong is part of China, they still maintain a separate tourism and immigration system so visiting Hong Kong is not the same as visiting the rest of China when it comes to visas and documentation.
Most Western, European and Asian tourists usually don't need a tourist visa to enter Hong Kong. The Hong Kong immigration web page has a list of countries that do need visitor visas, and the length of stay you are allowed without a visa.
But once you've arrived in Hong Kong, you would still need a separate visa if you wanted to enter mainland China. If you started your trip in China, you will need a multi-entry visa if you plan on visiting Hong Kong and then returned back to the mainland.
You can apply for Chinese tourist visas while in Hong Kong, but you may have a wait. It's usually better to arrange for your paperwork before your trip to ensure that it's all ready to go when you arrive. If you don't intend to leave Hong Kong, then there is nothing to worry about.
