Why did Roald Dahl write children's books?

Roald Dahl started out working for an oil company and then joined the Air Force. He had an accident which injured his hip, head and spine. He took a desk job and had a meeting with C. S. Forester who convinced him to write stories. He sold a book to Disney called, The Gremlins. When he had children of his own, he would tell them stories. This inspired him to write children's books. Eventually he wrote James and the Giant Peach. He wrote 19 children's books. Several have become movies including Matilda, James and the Giant Peach, and Charlie and the Chocolate Factory.