The story
First use appears c. 1938. John Q. Public was the name of a character created by Vaughn Shoemaker, an editorial cartoonist for the Chicago Daily News from 1922 to 1952; Shoemaker introduced this character in 1922 but is believed to have added the "Q." sometime in the early 1930s.https://www.nytimes.com/1991/08/22/obituaries/vaughn-shoemaker-created-john-q-public.html Compare also John Doe.
Etymology from Wiktionary, CC BY-SA 4.0.