Citing a spin.com interview of Randy Jones and David Hodo (respectively the cowboy and construction worker of the song):
Jones: We were flying up from South America for the show, and we
worked on the choreography on the airplane — handclaps, turning,
marching in place…stuff like that. Well, the audience at this
particular taping was a bunch of kids bused in from a cheerleader
camp. The first time we got to the chorus, we were clapping our hands
above our heads. And the kids thought it looked like we were making a
Y. So they automatically did the letters. We saw this and started
doing letters with them. It was purely audience-generated, which is
probably why it’s still so popular. And that’s great for me, because
it keeps the checks coming in every six months.
Hodo: When I saw the movements, I thought, “Wow, that is so stupid.”
Then everyone in America started doing it, and I thought, “Wow, that
is so brilliant.” It took on a life of its own. The next thing we
know, Hideki Saijo has the No. 1 hit in Japan with his version of
“Y.M.C.A.” And we hit No. 2 [in the U.S.]. That’s how it always works.
Saijo claimed to have invented the dance, so as soon as we got to
Japan, we straightened him out.