What gives the U.S. government the right to collect taxes?

we the people, through the US Constitution.

Article I, Sections 2 and 8
Also the 16th amendment

The U.S. government has the right to collect taxes based on the authority granted to it by the United States Constitution. Article I, Section 8 of the Constitution specifically gives Congress the power to "lay and collect taxes, duties, imposts, and excises" for the purpose of funding the operations of the federal government.

To find this information, you can read the United States Constitution, which is the supreme law of the United States. The Constitution outlines the powers and limits of the federal government, including the power to collect taxes. It is a good practice to consult primary sources like the Constitution itself to understand the legal basis for government actions.