The invention of pizza is most often credited to Raffaele Esposito, a baker from Naples, Italy. In 1889, Esposito is believed to have created what is considered the first "modern" pizza, the Pizza Margherita, topped with tomatoes, mozzarella cheese, and fresh basil, in honor of Queen Margherita of Savoy. This creation is widely recognized as the beginning of the pizza we know today.
Pizza as a concept, however, evolved from ancient flatbreads topped with herbs, oils, and other toppings enjoyed by various ancient civilizations such as the Greeks and Egyptians. But the signature combination of tomato, mozzarella, and basil on a flatbread that defines modern pizza originated in Naples in the late 19th century.
Thus, while flatbreads with toppings have ancient roots, Raffaele Esposito is generally credited with inventing modern pizza in 1889.