Ian Fleming wrote the first James Bond novel partly as a result of marriage and partly as a need to live out a life "Walter Mitty" style (try looking up that character). He decided on the name of "James Bond" because he saw a book on ornithology written by a James Bond and he decided, "what an absolutely boring name" and he wrote adventures that were anything but boring.
The rest. . . is history:-|
BTW his ideal James Bond would have been Hoagy Carmichael. He didn't care for Sean Connery -- something about class differences.