It cannot be known for sure -probably in many place at roughly the same time. They have been known for more than 5,000 years.
Lateen sails were adapted from the Mediterranean region.
Trapezoidal, actually. But the square sails were called square sails. Lateen or square could be referred to as yards.
ccfffvvb
They were referred to as "four-cornered" sails.
The triangular sail was invented beginning in the 16th century. They were first seen in the Mediterranean as single yarded lateen sails.
I'm not an expert, but I believe you can sail closer to the wind with a lateen-rigged sail than with square sails.
I believe it was invented in the Arabian Sea - plying the waters between India and Africa. To narrow it down more than that would be tough.
Lateen Sails
The lateen sail was invented around 100.
Triangular-shaped sails helped catch wind from the sides and rear.
Square sails are not truly square but rectangular with a longer long side on the bottom perimeter of the sail. They were and are referred to as "four-cornered" sails.
One type is the "lateen sail", but there are also jibs; Genoa & spinnaker.