Roma will sign Mancini on an initial one-year loan deal for a fee of 2 million euros but subsequently have to make the 23-year-old's move permanent for an additional 13 million euros.
The deal also includes a number of performance-related clauses worth a maximum of 8 million euros.
"The arrival of Gianluca allows us to boost our defensive options with a young defender that has great talent and is coming off a very impressive season," AS Roma sporting director Gianluca Petrachi said in a statement.
Mancini, capped twice by Italy, made 30 league appearances last season, scoring five goals.
The Fiorentina youth product made his move to the Bergamo-based club permanent last year.
If Mancini moves to another club, Roma will have to pay Atalanta 10pc of any potential future profit made on the player.