Xi's trip marked 20 years since Hong Kong was handed back to China by Britain, and analysts said his visit left little doubt that Beijing viewed the city as a destabilising hotbed of unacceptable political dissent.
His three-day stay culminated in a 30-minute speech warning that any challenge to Beijing's control over the city crossed a "red line", seen as a salvo against a new wave of activists calling for self-determination or independence, concepts intolerable to Beijing.
President Xi also inspected 20 squads of troops last Friday at the city's biggest military parade in the past two decades, where helicopters and armoured vehicles were displayed.
The 305 metre-long (1,000 feet) Liaoning, a secondhand Soviet ship built nearly 30 years ago and commissioned in 2012, arrived in Hong Kong early Friday, as a rainbow appeared overhead.
The aircraft carrier sailed through the East Lamma Channel, passing by residential buildings located on the south coast of Hong Kong island, and was berthed near the Tsing Yi region.
State news agency Xinhua said the carrier was accompanied by two destroyers and one frigate. J-15 fighter jets and two helicopters were seen on the carrier's flight deck.
"With the fleet's visit to Hong Kong, I believe residents will experience first hand China's tremendous achievements in defence, in the armed forces, and especially in the navy," the city's new leader Carrie Lam said at a welcoming ceremony.
Lam, who was sworn in by Xi on Saturday, said it would help "reinforce" residents' understanding of the nation.
China's national defence ministry had said the Liaoning, named after a northeastern Chinese province, was part of a flotilla on a "routine training mission".
Its arrival in Hong Kong would mark the 20th anniversary of China's People's Liberation Army (PLA) entering the city, defence ministry spokesman Wu Qian told reporters last Thursday.
Enthusiasm for the aircraft carrier was high with people queueing overnight at the PLA garrison in central Hong Kong for public tour tickets earlier this week.
But ticket-holders are banned from bringing cameras when they board the aircraft carrier on Saturday, reports said, while foreign media outlets have not been invited to cover the event.
Authorities have also set up a temporary no-fly zone in the area where the Liaoning will be berthed near the city's Tsing Ma suspension bridge.
After the handover in 1997, some feared the PLA would be heavy-handed given the army's crackdown on student protesters in Beijing's Tiananmen Square in 1989.
Instead they have maintained a low profile and are barred from interfering in local affairs.
China launched its first domestically built aircraft carrier in April, though it is not expected to enter service until around 2020 once it has been fully equipped and armed.