Cornell University Law School's Legal Information Institute explains that the Supremacy Clause is a provision in the U.S. Constitution that makes federal law override state law when there is a conflict between the two. However, state law is only overridden when the federal law falls within the constitutionally authorized powers of Congress. Federal courts determine when there is a conflict between federal and state law, and they have the power to nullify conflicting state laws.
The Supremacy Clause was included in the U.S. Constitution to avoid problems that arose under the Articles of Confederation, which reserved most powers to the states and granted only very limited powers to the federal government. Wikipedia explains that the lack of centralized power under the Articles of Confederation resulted in an inability of the federal government to raise revenue and led to conflicts both within and among the states. Federalists Alexander Hamilton and James Madison argued in the Federalist Papers that the Supremacy Clause was essential for the federal government to carry out its necessary powers and necessary to unify the nation.
Although federal law reigns supreme, the U.S. Supreme Court generally shows reluctance in overruling state law. According to the Legal Information Institute, it only does so when there is a very clear conflict between federal and state law.