In Mesopotamian mythology, Tiamat (Tiamat (Babylonian), Tamtu (Sumerian)) is a giant female dragon which was the primordial creatrix of all existence. She created the world and the gods, though this world had no land and was a vast water-world, filled with the waters of chaos. Tiamat personified the saltwater (ocean) while her consort Apsu (Apsu (Babylonian), Abzu (Sumerian)) personified the 'sweetwater' (freshwater). The intermingling of these two waters created the gods. In the Enuma Elish (the Mesopotamian creation epic), the gods bother Tiamat & Apsu, so the two decide to kill all their children. The god Ea discovers their plan and preemptively slays Apsu or casts a spell that puts him in a death-like sleep (since the waters of Apsu still exist even after his 'death'). Tiamat then sought revenge by creating an army of monsters and a new consort, Kingu (alt. Qingu) to be their general. Tiamat was slain by Marduk who trapped her with a "net of winds", shot arrows down her throat, and then cleaved her body in two, with the upper half creating the heavens and the sky and the lower half creating the earth. Tiamat is Akkadian for "sea".
Dungeons & Dragons (one of the inspirations for the original Final Fantasy) used Tiamat as an evil dragon goddess, specifically a 5-headed dragon (one black, one red, one green, one white, one blue). This is likely where Square got the idea to place her in Final Fantasy I.