In general, a person in the United States has the right to vote. As far as I can tell, this vote is private—no one else knows who you voted for. Why are the votes in congress public? Wouldn't it help the representatives and senators to vote with a secret ballot—they could then vote with integrity if they so chose to?
Constitutional mandate plus the momentum of tradition
Article 1, Section 5, third paragraph of the constitution reads:
Each House shall keep a Journal of its Proceedings, and from time to time publish the same, excepting such Parts as may in their Judgment require Secrecy; and the Yeas and Nays of the Members of either House on any question shall, at the Desire of one fifth of those Present, be entered on the Journal.
In principle the recording of votes in the Journal, which must then at some point be published (though the Constitution makes no clear distinction on what satisfies "from time to time"), could be avoided if more than 80% of those present in the chamber decides not to bother. But this is difficult to achieve, as a clear and unambiguous record of how a given congressmember voted on an issue is easily weaponized in the political arena. It's not unheard of, however: the House passed an amendment to FOIA in 2016 by a voice vote, with no record of individual votes being made, for example.
The constitution also provides no clarity on what would qualify for "Parts as may...require Secrecy". So in principle vote records could also be hidden by a chamber simply asserting that the matter requires secrecy. I do not know if this particular clause has ever been challenged in the courts; almost certainly not on the very specific issue of who voted how, if simply due to issues of standing. The secrecy provision would normally only be invoked for matters that are relevant to national security, or closed door testimonies before they're ready to make something public, and the like.
But a public record of votes in Congress is practically assured given the strong constitutional encouragement for open records of voting combined with the historical momentum of prior public voting behavior—indeed, the House and Senate chambers are normally open to the public whenever in session by default, as has long been tradition in most (perhaps all?) legislative chambers in the US for much of its history, including the Colony days, closing only when deemed necessary. And in recent years sessions are even broadcast live over the internet, making it difficult not to have things like votes be a matter of public record. The chambers always have control of what does and doesn't get broadcast—the recent broadcast of the Electoral College certification cut out at one point when the House's debate on a challenge seemed to nearly come to blows, for example—, but with that degree of public accessibility it becomes politically difficult to try to hide something like voting.
On that historical note, the first House, in 1789, chose to make itself open to the public almost immediately, but the Senate decided not to—they didn't even let members of the House in. In just a few years this started to become something of a black mark on the Senate in the public's eye, and the public's attention drifted primarily to the House (thereby depriving Senators of some measure of power via loss of influence). But the Senate remained fairly firmly against the matter for a few more years. When the Senate moved from Philadelphia to DC in 1800, there were no real rules at all on who was allowed, which eventually spiraled out of control around 1830. Over the next several decades the Senate went through some repeated headaches on the issue as they were politically pressured to expand the list of who could access the chamber while in-session, then trying to cull that list when they decided things got out of control.
In any case, the House has always been open to the public by default, making all of its voting behaviors open to the public by default. While the Senate was initially of a different mind on the issue of public access, ultimately the political pressures of having (mostly) non-public sessions being compared unfavorably to the House's public access ultimately resulted in the Senate joining the House in being open to the public while in session by default.