In return, the Athletics sent minor leaguers Greg Deichmann and Daniel Palencia to Chicago.
"Oakland is getting a really nice pitcher and a really nice human being who goes out and does his job. And a really good teammate," Cubs manager David Ross said.
Chafin, 31, is having a stellar season. In 43 appearances, he has given up nine runs, including just one home run. He is 0-2 overall with a 2.06 ERA and a 0.839 WHIP.
Chafin, though, has struggled recently, failing to record an out while giving up three runs on two hits and two walks in his last outing, on Saturday, against the Arizona Diamondbacks. It snapped a 24⅓-inning scoreless streak for the veteran.
Deichmann, a 26-year-old left-handed-hitting outfielder, was hitting .300 with four home runs and 34 RBIs for Las Vegas this season, his first in Triple-A. He has a .432 on-base percentage and an .881 OPS. He was a second-round draft pick in 2017 out of LSU.
Right-hander Palencia, 21, is in his first professional season after signing with Oakland as an international free agent out of Venezuela in February 2020. He was 0-2 with a 6.91 ERA in six starts for Class A Stockton, compiling 14 strikeouts and six walks in 14⅓ innings.
The Associated Press contributed to this report.