A similar question (with some answers that really epitomize what makes this sub great) has been asked before:
https://www.reddit.com/r/AskHistorians/comments/264obv/what_is_the_origin_of_the_story_behind_a_musical/