The phrase came from the Second World War. When British / Allied troops were granted a couple of days' leave, they were issued with a leave pass in the form of a receipt or 'chit' - hence 'chitty'.
What the soldiers then did with this short leave was up to them, but visiting local bars and brothels (especially when in Paris) was a popular option. Hence Chitty-Chitty, Bang-Bang !
Ian Fleming stated in his book that it was the sound the car made. I should imagine that it was highly likely he knew exactly the phrase's origin, and probably found its inclusion in a children's book rather amusing.