In the book, he actually goes out of a sense of duty to fulfill a contract which he was tricked into accepting by Gandalf. It's a matter of his good name and integrity. However, the movie changed things slightly by making Bilbo originally refuse to join the journey, but then the next morning he changes his mind.