The wartime codebreaker and computing genius was pursued for homosexuality, but nobody – until film-makers came along – accused him of being a traitor, writes Alex von Tunzelmann ...