The 41-year-old "Rock of Ages" screenwriter, who is dating Jennifer Aniston, will also pen the script for the upcoming comedy to be developed at Warner Bros Pictures, reported Ace Showbiz.
"Swear to God" focuses on Ferrell's character, who is a narcissistic hedge fund manager and thinks he has seen God.
Details of Carell's character are still unclear.
The new comedy will mark Theroux's second directorial effort after 2008's "Dedication".
The "Tropic Thunder" writer was last seen starring opposite his girlfriend Aniston in "Wanderlust".