Original: In an interview on the Season 1 DVD, Bradley Whitford said he was originally cast as Sam, even though Aaron Sorkin had created the Josh character specifically for him.
Simplified: Bradley Whitford states in an interview on the Season 1 DVD that he was originally cast as Sam, though the character of Josh was the role Whitford had wanted and for which he had auditioned. In addition, Josh's character had been written specifically for him by Aaron Sorkin.