The story
Popularized by Rudyard Kipling in his book, The Jungle Book (1894), in which he used the term in the literal sense of a legal code governing the behavior of his anthropomorphized animals in an Indian jungle. Note also the (possibly derived) colloquial sense of jungle (“a place where people behave ruthlessly, unconstrained by law or morality”).
Etymology from Wiktionary, CC BY-SA 4.0.