At Navy Boot Camp, our Company Commander told us that sign was originally a Liberty Ship inspector at the shipyard in Quincy, Massachusetts who was named Kilroy, and wrote that on the bulkhead of every space he inspected.
AND I found this on the Internet, so it must be true! ;-)
https://www.meadvilletribune.com/news/heard-and-seen-kilroy-was-here-there-and-everywhere/article_2c3854d8-207f-11eb-898c-ef1a0d36f957.html
I read specious psychoanalysis of that name once. Kilroy could have been a combination of kill and roi meaning it was a subconscious desire of the scribe to kill the king.