The following sentence is grammatically correct:
He swung his legs, and sang a song.
But I'm unsure if this is correct:
He swung his legs, singing a song.
It sounds correct to me, but I'm not sure about the present participle, unless what is meant is:
He swung his legs, [and he was] singing a song.