It's a myth in the most literal way. Fleming published and promoted his results despite a lack of reproducibility. By the time he won the Nobel Prize, he had backformed or misremembered a folksy story about an open window. That's textbook mythmaking.
It can both be fine to have a glib story to tell schoolkids and important to recognize that the actual intellectual process is messier and more complex.