Penny, 31, was 7-8 with a 5.61 ERA with the Red Sox this season and is 101-83 in his career. He will make a prorated minimum salary with the Giants and is expected to replace Joe Martinez in the Giants rotation.
Penny needed to complete the deal by Monday to be eligible for the postseason with the Giants. San Francisco is tied for the NL wild-card lead with the Rockies after sweeping Colorado over the weekend.
The Red Sox signed Penny to a $5 million, one-year contract last winter after he spent four-plus seasons with the Los Angeles Dodgers.
By signing with the Giants, Penny is set up to pitch against the Dodgers, his former team. The teams are next scheduled to meet for a three-game series starting Sept. 11.
Penny won 16 games for the Dodgers in 2006 and 2007, his career high. He was hampered by shoulder problems last year.
Penny left the team amid bad feelings on both sides at the end of last season.
Penny went 2-0 with a 2.19 ERA in two starts during the 2003 World Series, helping Florida beat the New York Yankees.
Penny will likely pitch Wednesday against the Phillies because the Giants have an open spot after pushing Lincecum back to Thursday to give him an extra day of rest. The Giants will have to make a roster move to open a spot for Penny. San Francisco already optioned fifth starter Joe Martinez to Triple-A Fresno on Friday.
The Big Unit, who won his 300th game in June, hopes to return from a shoulder injury in a few weeks but most likely as a reliever.
Penny is in his 10th major league season. He was a fifth-round draft pick by the Arizona Diamondbacks in 1996.
Buster Olney is a senior writer for ESPN The Magazine. Information from The Associated Press was used in this report.