The power to Gerrymander is the power to draw district boundries, and this power is described in the US constitution, Article 1 Section 4
The Times, Places and Manner of holding Elections for Senators and Representatives, shall be prescribed in each State by the Legislature thereof; but the Congress may at any time by Law make or alter such Regulations, except as to the Places of chusing Senators.
In other words, States can run their own elections, subject to Congressional oversight. So State legislatures use the power stated here to set district boundaries. As they have the power to determine boundaries, there is the temptation to use that power to partisan benefit.
There is the power for Congress to intervene, but only through passing Laws. For example, In 1842 Congress passed a law that prevented States from electing their representatives "at large". This was modified further in 1967 Therefore Congress has passed laws that require congressional districts to be drawn. And re-apportionment following a census means that re-districting must also happen.
So two laws that empower Gerrymandering are the US Constitution and 1842 Apportionment act.