Catherine was awarded a golden trophy after beating Prince William during a visit to Aberavon Leisure and Fitness Centre in Port Talbot.
"Not sure I am dressed for this," said the princess, who was wearing a cream top, checked skirt and black boots.
They also launched a series of therapy gardens and allotments during a visit to south Wales on Tuesday.
The initiative at Brynawel Rehabilitation Centre, near Pontyclun, Rhondda Cynon Taf, is intended to provide mental health support and is working with Life at No.27, a horticultural therapy and mental health counselling provider.
Later, the royal couple took part in a virtual endurance challenge to see who could ride the furthest in just 45 seconds uphill in the Italian Dolomites.
On entering the room, Prince William apologised to cyclists and said: "Sorry for ruining your spin class."
Before climbing on to his bike, the prince joked to the princess: "You have got high heels on."
She adjusted the gears during the race and laughed: "Can I make it harder?"
After finishing, Prince William, who was breathing deeply, joked: "Talk to you in a minute."
Catherine was presented with a trophy dubbed the Tour de Aberavon.
On a visit to a garden at Brynawel Rehabilitation Centre, the prince laughed as he spotted some Sweet William seeds on a label.
Volunteer gardener Vanessa Townsend helped Catherine to sow the seeds, telling her: "They will flower in two years, I'll make sure you get some."
The princess was presented with a bunch of daffodils by two-year-old Cora Phillips.
Cora's mother Michelle Phillips, from Llanharan, said: "Oh my goodness, I did not expect that in a million years."
The royal couple were also greeted by a Great Dane therapy dog called Ragnar.
Annabelle Padwick, founder of Life at No.27, said gardens were vital in offering a safe environment for those facing mental health difficulties.
"As the founder I have seen first-hand how working with therapy gardens can dramatically improve self-belief and your own mental health," she said.
The Brynawel Rehabilitation Centre is a residential site for the treatment of alcohol and drug dependencies.
Residents from the wider community, who are experiencing mental ill health, low confidence or isolation, will also eventually be given access to the garden through GP referrals.
The prince and princess later visited the Welsh Air Ambulance base in Llanelli.
The charity celebrates its 22nd birthday on Wednesday.
Prince William spoke to the High Sheriff of Dyfed Rowland Rees-Evans, greeting him with the Welsh phrases for "good morning" and "how are you?"
"I have been saying bore da and shwmae all day. I'm working on my repertoire," he told Mr Rees-Evans.
The prince and princess also visited the Welsh Air Ambulance base in Llanelli in Carmarthenshire, where they met the wife and children of a man who died in a road traffic accident.
They spoke with Laura Davies and her two children Sofia, nine, and Owen, 11, in a private meeting in the charity's new family room, which was created after the tragedy.
She said: "Arwel was a really, really special person and to have a room like this named in Arwel's memory, and for it to be recognised by Prince William and Princess Catherine, is a testament to the special person he was.
"This means a huge amount to the children, it's a lasting legacy for them as to how special daddy was."
Amanda Berry, chief executive of The Royal Foundation, said: "Their Royal Highnesses are passionate about creating a lasting impact in the communities they visit, playing an instrumental role in bringing together local stakeholders to amplify the work of organisations, and ensure support reaches those who need it most.
"Their Royal Highnesses continue to prioritise our society's mental health and spending time in nature is known to have a range of benefits, including reducing depression and anxiety."