Anderson, released by the Cleveland Browns, agreed to a two-year deal.
Leinart had been the only quarterback on Arizona's roster following the retirement of Kurt Warner.
"We have seen a tremendous amount of growth from Matt. He has worked hard," coach Ken Whisenhunt said Wednesday, "but I am also excited about Derek and there will be competition at that position. That's not anything different than what we have at other positions."
Anderson spent five up-and-down seasons with the Browns, where he lost his starting job to Brady Quinn at the start of last season. He got the job back, lost it, then got it back again when Quinn got hurt.
"I think a fresh start was something that I wanted," he said in a conference call, "getting out of Cleveland and getting out there and compete and kind of prove that I can play. 2007 was a great year, but the last couple of years haven't been, obviously, good for me or the team I was playing on. So I am just excited about anew opportunity with a new team."
The 6-foot-6 former Oregon State quarterback had been claimed off waivers by Cleveland from Baltimore in 2005. He made the Pro Bowl in 2007 when he threw for 3,787 yards and 29 touchdowns, leading the Browns to a 10-6 record.
Anderson, who took a parting shot at Cleveland fans when he was released, then apologized, hoped new scenery would turn things around for him.
"New coaches, new everything, new life, kind of start over a little bit will be good," he said in a conference call. "Obviously, like I said, the receivers and the skill position guys that they have was something that I thought was a big thing about coming down there."
Anderson visited the Cardinals last Friday. He also made a stop in Seattle. Anderson knows Leinart is ahead of him on the depth chart.
"It was understood to me that I was going to be the No. 2 and come in and compete and do what I've done over my career," he said. "I am coming into camp and everything like that and I've gone into every training camp I have been involved in thinking I am going to play and get better. Obviously, my job will be to push Matt and make him better, too."
Leinart, the former Heisman Trophy winner at USC, lost the starting job to Warner in the 2008 training camp. Warner, of course, went on to lead the Cardinals on an improbable run to the Super Bowl that season, then directed the team to a second straight NFC West crown and the second round of the playoffs last year.
Whisenhunt said he got a text from Leinart on Wednesday saying he "knew there was going to be competition, but he was going to show he was ready to play. "
"So that indicated to me that Matt was in a good place," the coach said. ".... I don't know necessarily that it was a function of any announcements about us reaching an agreement with Derek as much as it was just Matt staying in communication. That is what we want from our players and I was excited to see that."