Why say "nay" when you could say "no"
Solution 1:
Apparently, Early Modern English had a four-form system of yes and no, where yes and no were used to answer negatively phrased questions (e.g., "Will he not go?") whilst yea and nay were used to answer positively phrased questions (e.g., "Will he go?"). Since the sort of questions voted on by assemblies are positively phrased, I'd imagine that the legislative use of yea and nay is a relic of this earlier usage.
Solution 2:
Section 7 of the US Constitution specifies that Congress must vote on bills using Yea and Nay, and so it does. That specification instead of Yes and No still had meaning in formal matters the 1700s per the four-form Yea/Yes/Nay/No system mentioned by Branimir Ćaćić, even though Yea and Nay were by then falling out of use in common speech.