As America celebrates George Gershwin's special contribution to his country's music, 50 years after his death, a footnote is in order about his impact abroad.

His music surfaced unexpectedly in Denmark one evening just after World War II in Tivoli, Copenhagen's idyllic amusement park. The lights that German troops had smashed during the occupation had just gone on again. In the restored concert hall, an evening of music concluded with a rendition of ''It Ain't Necessarily So,'' from Gershwin's ''Porgy and Bess,'' and the audience applauded with astonishing ardor.

Why? Some Danes explained: During the occupation, the nightly Danish-language German propaganda broadcasts would boast of great German victories and humiliating Allied defeats. And every night an elusive resistance station would cut in, at the conclusion of the German boasts, with the opening bars of ''It Ain't Necessarily So.'' No words; no comment. George Gershwin had become a Danish folk hero. In a dark hour, he provided a theme song of optimism.