Agreement for the use of the location has been reached between the chapel's trustees and Rose Line Productions. The 15th century chapel saw a surge in visitors after the book's plot suggested it was built to house the secret of the Holy Grail.
Despite being derided by the Catholic church and many historians, Dan Brown's work has sold 17 million copies worldwide.
Trustees spokesman Stuart Beattie said: "The chapel has long been a popular destination for hundreds of years. "There are many stories in Rosslyn's long history and I'm sure the chapel will make a superb backdrop for this particular one."
He was confident the trustees would feel the film was value for money. Location fees alone could generate £100,000.
A spokesman for Rose Line Productions described Rosslyn as a "magnificent" building which would enhance the quality of the film.
Tom Hanks, will play the lead role with Audrey Tautou the female co-star. Oscar winner Ron Howard will direct the movie.
The chapel will close for the filming between 26 and 29 September.
However, Dr Andrew Sinclair, a descendent of the family that founded the chapel and a former Cambridge historian, is reported to have said that the filming will ruin the chapel's reputation. He also said it would lead people to believe the "preposterous" claims made in the book.
Lincoln Cathedral will double as Westminster Abbey after the latter refused permission to film, describing The Da Vinci Code as "theologically unsound".
The book alleges that Jesus married Mary Magdalene and had children. It centres on a murder in a secrety society and the trail leads to Rosslyn Chapel.
The chapel, which is six miles south of Edinburgh, was visited by 68,603 people in 2004-05.