Lam was selected by a pro-Beijing committee, as were her predecessors, and is already being cast by critics as a China stooge in a city where many are angry at Beijing's tightening grip on the freedoms of nearly eight million people.
She took her oath of office under China's national flag at the city's harbourfront convention centre, before shaking hands with Xi.
The Sino-British Joint Declaration gave Hong Kong rights unseen on the mainland through a semi-autonomous "one country, two systems" agreement, lasting 50 years.
There are growing fears that those freedoms are now under threat from an assertive Beijing, with Chinese authorities accused of interfering in a range of areas in Hong Kong, from politics to media and education.
More From This Section
Pro-China protesters targeted a small march by activists in memory of the victims of Beijing's 1989 Tiananmen Square crackdown this morning as officials gathered for the swearing in.
Flag-waving pro-China protesters then blocked the march as police struggled to separate the two sides.
Democracy campaigners were taken away in police vans and released soon after.
Lam's swearing in by Xi is deeply symbolic for frustrated activists who have been pushing for fully free leadership elections for the city, with mass pro-democracy "Umbrella Movement" rallies bringing parts of the city to a standstill in 2014.
Those protests were sparked by a Beijing-backed political reform package which said Hong Kong could have a public vote for leader, but that candidates must be vetted first.
Lam has made no commitment to revisit it soon.
The failure of the democracy movement to win concessions has led some young campaigners to call for self-determination or even independence for the mainland, which has infuriated Beijing.