The Leviathan first appears in Tanach as a mighty sea creature that no man can subdue — God challenges Job directly, asking whether Job can draw it out with a fishhook or pierce its jaw (Job 40:25-41:26), while Tehillim describes God crushing the heads of Leviathan and the sea monsters at creation, feeding it to the dwellers of the wilderness (Tehillim 74:13-14).
Chazal identify the 'great sea monsters' (תנינים) of the creation account with Leviathan and its mate, a male and female created together (Bereshit Rabbah 7:4), a reading followed by Rashi on Bereishit 1:21 and the Ramban (Bereishit 1:21), who both add that God slew the female and salted her away for the righteous in the future, since were the pair to multiply the world could not withstand them.
The Gemara elaborates with aggadic episodes of these giant creatures: a story of a ship-bound traveler who saw a tannin encircling a precious stone and barely escaped (Bava Batra 74b-75a), and the account of Rabbi Eliezer and Rabbi Yehoshua on a boat, where the great light at sea is explained as the eyes of the Leviathan, of which Rabbi Yochanan says there are two — nachash bariach and nachash akalaton (Bava Batra 74b:3).
Other aggadic sources describe Leviathan's cosmic role: Pirkei DeRabbi Eliezer 9:7 tells that Leviathan was formed on the fifth day to dwell in the lower waters, feeding on the great sea monsters, with God playing with it daily; and Avodah Zarah 3b:8 locates this divine play with Leviathan within the fourth quarter of each day, citing the same pasuk from Tehillim. Rashi on Tehillim 104:26 and Targum Yonatan both tie this playfulness to the verse in Iyov and to the future feast prepared for the righteous.
On the question of Leviathan's identity and physical nature, the Rishonim diverge somewhat: Ibn Ezra on Tehillim 104:26 suggests Leviathan may simply be a general term for any large known sea creature, since sailors report seeing great beasts in the sea; and Sifra, Shemini, Section 3:5 records that Rabbi Yosei ben Durmaskit held Leviathan to be a kosher fish, deriving this from the scales and fins described in Iyov. This question of its kashrut is taken up at length by Sdei Chemed, Maarechet Lamed 129, who cites conflicting views on whether Leviathan is pure or impure and whether the future feast is a literal meal.
Rashi on Yeshayahu 27:1 and Ibn Ezra on Yeshayahu 27:1 read the Leviathan of Yeshayahu allegorically, as figures for great nations or cosmic powers — Rashi explaining the 'straight' and 'crooked' serpents as Egypt, Assyria, and Edom in sequence, and Ibn Ezra identifying Leviathan there with the celestial 'tali,' called bariach because it stretches from end to end.
Kabbalistic and later sources read Leviathan on a still more symbolic plane: the Zohar, Bereshit 4 situates the primordial waters and their forces within the account of creation, and Sulam on Zohar, Shmini 76 explains the great sea monsters as expressions of the attribute of Din issuing from Binah; Pardes Rimmonim 23:22:30 cites the Rashbi identifying the 'great tannin' with Tiferet, the central bar within the planks of the Mishkan. Peri Tzadik, Toldot 4:2 similarly reads nachash bariach and nachash akalaton as rooted in the kelipah of desire, tracing back to the primordial sin of the nachash.
Chiddushei Aggadot, Bava Batra 75 holds that the Leviathan is entirely nonphysical, so that the future feast of the righteous consists of receiving its spiritual essence rather than eating an actual meal, while Valle on Bereishis 8 describes the great sea creatures as capable of ramming or swallowing ships but restrained from doing so by the awe God instills in them.
Among more recent interpreters, Rav Samson Raphael Hirsch reads the tannin as a 'monstrous fish' rather than a serpent, suggesting Pharaoh himself is called the great tannin dwelling in his rivers, apparently referring to the crocodile (Rav Samson Raphael Hirsch); and elsewhere Hirsch proposes that Leviathan, parallel to Behemot, may not denote a single creature at all but serve as a collective term for the animal kingdom of sea and land, so that the prophecy in Yeshayahu of God's sword against Leviathan nachash bariach and nachash akalaton refers to societal and national forces rather than a literal beast (Rav Samson Raphael Hirsch).
Notes and Corrections on Midrash Lekach Tov, Shemot 18:38 links the 'great tannin' to Pharaoh via Yechezkel's image of the great dragon crouching in his rivers, noting the Mechilta's reading that the hand from which Israel was saved was 'the hand of the great tannin' rather than Pharaoh directly.
Likkutei Sichos 5 בראשית 2 examines why Rashi must invoke the aggadic tradition identifying the tanninim with Leviathan at all, showing that the simple meaning of the verse's singular and plural forms cannot be settled without that aggadic layer, and concludes that the Midrashic identification is necessary even for establishing the plain sense of the creation account.