The striker, who is coming to the end of his contract with Manchester United, has signed a three-year contract with the Bluebirds.
The 22-year-old told the club's website: "It's a massive opportunity for me and it is with thanks to [manager] Ole Gunnar Solskjaer that I am here. He played a big part of my decision and I'm really looking forward to starting this season.
"Last season I had a good spell on loan at Birmingham City, but this is a new chapter of my career now and I can't wait to get started and show everyone who I am.
"Knowing Ole, he wants to get back into the Premier League as soon as possible and the recent signings show that. I'm here for the same reason. I feel that this is a great team and if we can have a good season and work hard then we can go straight back up."
Macheda scored 13 goals in a total of 22 appearances during loan spells at Birmingham City and Doncaster Rovers in the 2013-14 season.