The striker, who was capped by England only 11 months ago, joins the Championship leaders for an undisclosed fee.
Campbell has been restricted to just one Premier League start for the Black Cats this season following Steven Fletcher's arrival and would have been out of contract in the summer.
The 25-year-old, who came through the Manchester United youth system, was previously linked with Hull City, where he spent a season on loan in 2008/9.
Cardiff boss Malky Mackay told Sky Sports News: "He got a cap for England last year so we're getting someone of real quality.
"We've had a chat and he definitely wants to do well and play regular football now.
"He's got aspirations in terms of playing at the top level again and adding to that England cap. He wants to come and do well and play consistently.
"He played in the Championship with Hull and had a great return with them, one goal every two games.
"He's someone that I think will add quality to our squad and I'm delighted to get him."
Mackay also confirmed the former Hull man looks certain to be the only attacking addition to his squad, although the Scot may look to boost his squad at the other end of the pitch.
"We may bring in some defensive cover but the main addition was Fraizer," he said. "If we can get defensive cover in the correct position, the correct person, we'll do that."
Campbell is due to fly out to join his Bluebirds team-mates for their five days of warm-weather training in Dubai.