Visitors must isolate themselves in hotel rooms or go to government-run centres, while returning Hong Kong residents must stay inside their homes.
Anyone caught flouting the new rules faces a fine and a prison sentence.
Tens of thousands of travellers queued at the Chinese border city of Shenzhen ahead of the midnight deadline.
Hong Kong has seen 26 confirmed cases of the virus and one person has died. The number of confirmed cases in mainland China stands at 31,203, with 636 deaths.
Outside China, 270 cases have been confirmed in at least 25 countries, with one other fatality - in the Philippines.