Tarshish was a port that could accommodate large, oceangoing vessels which would have sailed for months, going beyond the Mediterranean. Such things as peacocks and apes were brought to it from afar, I Kings 10:22. Some have misunderstood this and have thought there was another Tarshish or even several of them. But there was only one.
Smaller, local vessels would have gone from places like Joppa to Tarshish to bring back goods from the larger port of Tarshish and, thus, Tarshish was synonymous with the variety of foreign items from all parts of the then-accessible world. So he took ship from Joppa in order to get a passage abroad from Tarshish.
Thus Jonah actually hoped to go far, far further than Tarshish. Jonah was hoping to get away, permanently, to some far flung place. It was a desperate attempt at escape from something that was, to him, traumatic and incomprehensible.
The later part of the book reveals his conflict. He already knew that God would hear the repentance of Nineveh. He already knew that that was why he had been sent. To warn them in advance and give them an opportunity. And he knew that these people would repent.
Unlike Israel.
And that caused him genuine trauma. How could Gentiles be treated so ? How could God's people, Israel, receive such prophetic warnings and still harden their hearts ? How could God send a prophet to Gentiles ?
And what would happen to himself, once they repented at his words ? Why, the judgment would not fall. And what then ? Who would respect him as a prophet if judgment did not come down from God at his words ?
These are the kind of thoughts that Jonah must have had and that provoked him to run away, as far as possible, from an inward conflict that he could not bear.
And yet, what a thing occurred to Jonah - down into the depths, and worse than depths, into the belly of the fish. Yet in all this, his cry came up to the Lord and he was heard. And he became a singular figure of Christ in death and resurrection.
That which I've vowed I will not fail
to pay, as by my word.
Thanksgiving I will render sure,
salvation's of the Lord !
(From 'The Songs of the Witnesses.')
[Further Note on Tarshish : The city, of course, became 'Tarsus' under Roman rule and was one of the non-Italian cities which could confer Freedom upon its citizens. Thus Paul could, later, say, 'A citizen of no mean city' and he was able to claim that right when in custody, that he was a free man, much to the discomfiture of the centurion (clearly also not a born Roman) who had paid a high price to gain his freedom.]