Ken Rosenthal of FOX Sports first reported the agreement, while Jeff Passan of Yahoo! reported the finances.
The Royals were known to have had interest in Hammel, 34, for several weeks.
Hammel, who went 15-10 last season with the Cubs with a 3.83 ERA, will join a rotation with Danny Duffy, Ian Kennedy, Jason Vargas and Nathan Karns.
The deal, which likely is backloaded, will push the Royals' payroll to more than $140 million. The Royals' payroll last year was near $145 million and management was instructed to trim the payroll for 2017, something that now appears to have been achieved only marginally.