“I’m My Own Grandpa” (sometimes rendered as “I’m My Own Grandpaw“) is a novelty song written by Dwight Latham and Moe Jaffe, performed by Lonzo and Oscar in 1947, about a man who, through an unlikely (but legal) combination of marriages, becomes stepfather to his own stepmother — that is, tacitly dropping the “step-” modifiers, he becomes his own grandfather.
In the ’30s, Latham had a group, the Jesters, on network radio; their specialties were bits of spoken humor and novelty songs. While reading a book of Mark Twain anecdotes, he once found a paragraph in which Twain proved it would be possible for a man to become his own grandfather. In 1947, Latham and Jaffe expanded the idea into a song, which became a hit for Lonzo and Oscar.
According to an article by James Pylant at genealogymagazine.com, the song was inspired by an anecdote that has been published periodically by newspapers for well over 150 years. The earliest citation was from the Republican Chronicle of Ithaca, New York on April 24, 1822 and that was copied from the London Literary Gazette:
A proof that a man may be his own Grandfather.—There was a widow and her daughter-in-law, and a man and his son. The widow married the son, and the daughter the old man; the widow was, therefore, mother to her husband’s father, consequently grandmother to her own husband. They had a son, to whom she was great-grandmother; now, as the son of a great-grandmother must be either a grandfather or great-uncle, this boy was therefore his own grandfather. N. B. This was actually the case with a boy at a school in Norwich.
While not frequent, situations such as this do occur occasionally in life, the Bill Wyman/Mandy Smith affair (including his son and her mother) being one celebrity example.
The situation is included in a set of problems written attributed to Alcuin of York, and also in the final story in Baital Pachisi; the question asks to describe the relationship of the children to each other. Alcuin’s solution is that the children are simultaneously uncle and nephew to each other; he does not draw attention to the relationships of the other characters.