William said that "as someone who lives with his own grief" it matters that those we have lost are never forgotten, as he addressed families at the Glade of Light memorial, a short distance from the Manchester Arena.
The duke called the city an "extraordinary place" which had refused to "look back in anger" but responded to hate with love.
William, who in the morning accompanied his father the Prince of Wales to the Queen's Speech in Parliament, was accompanied by the Duchess of Cambridge to the ceremony, which comes ahead of the fifth anniversary of the terror attack on May 22 2017.
The royal visitors attended a short service, before William made his brief remarks and walked around the memorial, where the duchess laid a bouquet of flowers.
Relatives of the 22 who were killed wiped away tears and exchanged hugs as a choir sang Halo by Beyonce, which includes the refrain, 'I can feel your halo'.
Among those killed were Sorrell Leczkowski, 14, from Adel, Leeds; Courtney Boyle, a 19-year-old Leeds Beckett University student, and Wendy Fawell, 50, from Otley.
William told the families: "For Catherine and I it is very important that we are with you here today. To remember the 22 lives so brutally taken.
"To acknowledge the hundreds of lives that were irrevocably changed and to pay tribute to the resilience of this great city.
"I remember only too well the shock and grief on the faces of those I met when I visited Manchester in the days following the atrocity.
"Five years on I know that the pain and the trauma felt by many has not gone away.
"As someone who lives with his own grief, I also know that what often matters most to the bereaved is that those we have lost are not forgotten.
"There is comfort in remembering. In acknowledging that, while taken horribly soon, they lived.
"They changed our lives.
"They were loved, and they are loved. It is why memorials such as the Glade of Light are so important. Why Catherine and I so wanted to be amongst you today."
The duke said the memorial would be a place of solace for families and for all Mancunians.
He added: "And we remember the entirety of the Manchester community who responded in the most heart-warming and life-affirming ways possible to support those affected.
"This was an attack on an evening of music. And it occurred in a city that has given the world so many songs to sing.
"When the people of Manchester gathered to pay respects to the victims just days after the atrocity, you told the world that your music would not be silenced.
"Instead, you raised your voices together and you sang a song of love that was written by some of this city's most famous sons.
"On that day you told each other that you would not look back in anger. And you showed the world the true heart of this extraordinary place. So, when we come to this memorial let's look back with love for those we lost.
"Let's look back with love for the people who cared for and protected this community.
"And let's look back with love for the ongoing strength of the great city of Manchester."
After the duke's speech, in which he also thanked emergency responders on the night, the Right Reverend Dr David Walker, the Bishop of Manchester, said the 22 would be "forever in our hearts" before reading out each of their names followed by a period of silence.
The Manchester Survivors Choir and former pupils at Parrs Wood High School Choir, who took part in the One Love benefit concert with Ariana Grande following the attack, then sang the Beyonce hit Halo, as visibly moved relatives wiped tears away.
The duchess then laid flowers before the royal visitors spent 20 minutes viewing the memorial.
They then went to a private reception inside Manchester Cathedral to speak to some of the bereaved families and those from the emergency services who dealt with the aftermath of the attack.
Earlier Councillor Tommy Judge, the Lord Mayor of Manchester, welcomed the families and the royal visitors to the city, and said May 22 2017 was a "dark day" for Manchester, with 22 lives "stolen", but that the victims would never be forgotten.
Joanne Roney, the chief executive of Manchester City Council, said the 22 would forever be honoured with the memorial, in the heart of Manchester, a city that came together in "sorrow and love" after the attack.
The white marble "halo" at the centre of the memorial bears the names of those killed, containing personalised memory capsules, containing mementos and messages, which are embedded inside the halo.
The tribute, close to Manchester Cathedral, is conceived as a living memorial - a peaceful garden space for remembrance and reflection, featuring plants which grow naturally in the UK countryside and have been selected to provide year-round colour and echo the changing seasons.
Around the anniversary every year the white flowers of a hawthorn tree planted at its centre will bloom.
Relatives who lost loved ones have already made private visits to the memorial, which was opened to the public earlier this year, before the official opening on Tuesday, 12 days before the fifth anniversary of the attack.
Suicide bomber Salman Abedi, surrounded by the throng of elated youngsters and parents waiting to collect them in the foyer of the arena following an Ariana Grande concert, exploded his shrapnel-packed rucksack bomb, sending thousands of nuts and bolts shredding everything in their path.
Hundreds of people were injured alongside the 22 who died, including six children.
The bomber's younger brother, Hashem Abedi, was jailed for life in March 2020 and must serve 55 years before parole, for his part in the terror plot.