A number of legal principles used to protect owners against improper use of their trademarks derive from federal laws known collectively as the Lanham Act (Title 15 U.S.C. §§1051 to 1127).
In addition, all states have statutes that govern the use and protection of marks within the state's boundaries. In addition to laws that specifically protect trademark owners, states also have laws that protect one business against unfair competition by another business, including the use by one business of a name already used by another business in a context that's likely to confuse customers.
The basic rules for resolving disputes over who is entitled to use a trademark come from decisions by both federal and state courts (called "common law"). These rules usually favor the business that first used a trademark, if another company's use of the same trademark would be likely to cause customer confusion.