It comes from the Italian word "confetto," which means "candied fruit" or "sweetmeat." In the 15th century, sugar-coated almonds, known as confetti, were thrown at weddings as a symbol of good luck and prosperity.
Over time, the practice evolved to include other small, colorful items thrown at celebrations. The word "confetti" then came to refer to the items themselves, not just the candy.