A large part of the purpose of the Book of Jonah is to describe the universal power and sovereignty of God.
Israel was not always monotheistic in her beliefs. Much of the early history of Israelite religion, as it can be seen in the Hebrew Bible, was actually what is called monolatrist, that is to say, she worshipped only one God but her religion did not deny the existence of other gods. This is a position very widely accepted in modern biblical scholarship. A good summary of the case is in John Day's Yahweh and the Gods and Goddesses of Canaan (Continuum, 2002).
Israel's religion was very much bound up in the land. There was considered to be a tight link between the God of Israel (YHWH) and the land of Israel. In a sense, YHWH's power was considered to be limited to the land of Israel.
The most significant turning point in this history was the Exile in Babylon. At this point, Israel was uprooted from the land. This appeared to show YHWH's impotence. What it ultimately did, however, was cause Israel to reappraise her theology. Instead of "YHWH is our God, connected to our land", it was now "YHWH is the God, connected to every land". The kings of other nations (most famously Cyrus of Persia in Isaiah 45, but even to some extent Nebuchadnezzar) are portrayed as tools of YHWH. Joseph Blenkinsopp's commentary on Isaiah 40-55 (Yale, 2002) is a good summary here.
The Book of Jonah was probably written in the post-exilic period (see e.g. the USCCB commentary). It reflects some of these ideas. Many interpreters take it as a rebuttal of the conservative Israel-only movement epitomised by Ezra and Nehemiah.
The whole narrative satirises the idea that God is concerned only with Israel. We see this, for instance, in the episode with the bush. Jonah gets angry about the death of the bush, but YHWH points out that he is far more concerned with the great city of Nineveh:
Then the Lord said, ‘You are concerned about the bush, for which you did not labour and which you did not grow; it came into being in a night and perished in a night. And should I not be concerned about Nineveh, that great city, in which there are more than a hundred and twenty thousand people who do not know their right hand from their left, and also many animals?’ (Jonah 4.10f., NRSV)
Nineveh is, of course, of great symbolic significance, since it is the capital of the Assyrian Empire that destroyed the Northern Kingdom of Israel. In many ways, it is an analogue of Babylon. The fact that YHWH's prophet would be sent there in itself makes a radical theological point.
Jonah's attempt to flee to Tarshish must be understood in this context, reading it as related to the wider theological purpose of the book. It's a joke, really: Jonah says, "No, I'm not going there, I'm running away where you can't get me." YHWH (and the writer of the book) mocks this idea, saying "You think you can get away from me? My power extends even to Tarshish, even to Nineveh."
A similar point is made by YHWH's power over the sea. Typically, in ancient Middle-Eastern religions, the sea is seen as the place of chaos and uncontrollable power, the place where the gods have no power. In asserting YHWH's power over the sea, the author asserts his power over everything. (A similar point is made by the continued references to the sea in Deutero-Isaiah, Isaiah 40-55.)
So this, then, is why the Book of Jonah sees him attempt to flee. It is precisely making the point that, even though he thought he could escape YHWH's power, he could not, because the whole of the earth is under his dominion.