How the tech firm’s artificially intelligent Twitter chatbot went from sweet tween to Holocaust denier overnight