Giles, a left-sided player who can operate in defence or midfield, played in the Championship last season during loan spells at Coventry and Rotherham.
The England Under-20 international, 21, has appeared once for Wolves, in an FA Cup tie at Shrewsbury in 2019.
"Cardiff City is a massive club, with a great history and an amazing fanbase," Giles told the Bluebirds' website.
"It was a no-brainer when I knew the interest was there," he added. "There are some very good players here and I think the competition will be healthy. Hopefully it will bring the best out of me."
Giles is Championship side Cardiff's fourth summer signing after defender Mark McGuinness, striker James Collins and midfielder Ryan Wintle.
Need a VPN? Or seeking to switch? Then support Tribal Football by clicking here to sign up with our official partners NordVPN. Not only will you receive the best VPN experience, but also great discounts by signing up via Tribal Football. Thanks for your support!