The XYZ Affair was also called the Quasi-War with France. By 1798, relations between France and the United States had grown bitter due to what France saw as the United States' support of Britain in her war against France. The French retaliated by seizing cargo from U.S. ships and impressing the country's seamen into serving on French ships. The French government also refused to receive the U.S. ambassador to France, Charles Cotesworth Pinckney.
Pinckney had been appointed by George Washington, but John Adams, who succeeded Washington, didn't wish to start a shooting war with France. He sent three envoys to France to see if a peaceful settlement could be worked out between the two countries. However, the envoys, one of whom was Pinckney, were insulted by the three agents the French had appointed to deal with them. They basically demanded that the United States pay a bribe to Talleyrand, the French foreign minister.
When President Adams reported this to Congress, he named the French agents only as X, Y and Z. A Navy was raised for a possible war. However, France didn't want a war and took steps to reconcile with the United States.Learn more about US History