What is meant by "[X] shall inherit the earth"? This phrase is found countless times in the scripture (cf. Psalm 37:11, Matthew 5:5), but should this be interpreted as a physical possession of land? If the righteous all end up in Jerusalem, what use would people have of the earth?
Is Matthew 5.5 in the same line of thought?
To start, we should double check that Matthew 5.5 is relevant to interpreting any texts from the Hebrew scriptures ('Old Testament'). We want to be careful not to group it with those texts if they're not even using the same language. A simple way to verify this is to compare Matthew 5.5 with the Greek translation of the other verse provided in the original question.
In Matthew 5.5, the Greek phrase used is 'κληρονομησουσι την γην'. In Psalm 37.11, the Greek phrase used in the Septuagint (numbered as 36.11) is 'κληρονομησουσιν γην'. Same verb, same noun. In both cases, it is the 'πραεις' (meek, mild) who will inherit. This would immediately suggest the Jesus logia in question was following a common expression of Jewish thought, so we're justified in keeping it a part of the discussion.
Inherit the... what?
Something to take note of is that the Greek word for 'earth' (γην, gen) in Matthew 5.5 and LXX Psalm 36.11 can just as well be translated 'land' or even 'ground'. The same is true for the Hebrew word (ארץ, 'erets), used in Psalm 37.11. So to fully grasp which definition of 'earth' is being used, we should understand it as it is used in conjunction with 'inherit' (Greek κληρονομεω; Hebrew ירש).
In the Hebrew scriptures
Taking the Hebrew scriptures in their present shape, the 'earliest' place we find this specific combination of the verb 'inherit' (ירש) and the noun ארץ is in Genesis 15.7, where God promises an ארץ to Abram that he will 'inherit'. As the narrative of Genesis continues, it becomes clear this ארץ is the 'land' that Abram's descendants would settle to live in, and not the whole planet.
The phrase 'inheriting the land' is used for the land promised to Abram throughout the historical narrative of the Hebrew scriptures (Genesis 28.4; Leviticus 20.24; Numbers 21.24,35; 33.52-55; Joshua 1.11,15; 12.1). The pairing of this verb and noun is found more than 40 times (almost half of the total) in the book of Deuteronomy alone, almost all of which are used in this sense.
The pairing is used in a negative sense on occasion in the same books mentioned above, referring to the people who then-currently 'possessed' the 'land', tribes that Israel was instructed to expel from the area (e.g. Judges 1.27,32-33).
To 'inherit the land' is to possess and dwell in the specific geographical region that God promised to Abraham.
When we find the phrasing used in the Psalms (only eight times, five of which are in Psalm 37), it is historically probable that the above is the intended meaning: to dwell in the land of Israel. This is most obvious in Psalm 44.3 and 105.44, both of which are psalms about the entry of the Israelite tribes into the land of Canaan to 'inherit' it.
There are only two exceptions that I can find. One, Isaiah 14.21, seems to use it in a more global sense. A prophecy is made against the kingdom of Babylon, 'lest [the sons of the king of Babylon] rise and inherit the earth'. The other, Habakkuk 1.6, also uses it for Chaldea (Neo-Babylon), but because it is a prophecy of judgment against Judah, it may still yet be referring to the specific region of Israel, and not in a global sense.
In Matthew 5.5
The specific pairing of the verb 'inherit' (κληρονομεω) and noun 'land' (γην) is found only in Matthew 5.5 in the New Testament. Although it is a part of the Beatitudes (Matthew 5.1-12), it is not found in the Lukan parallel (Luke 6.20-23). Arguably, this is in keeping with Matthew being the more 'Jewish' of the two books, as is widely suggested.
When we take the Beatitudes in the larger context of Matthew's 'Sermon on the Mount', it kicks off a series of Jesus' logia specifically concerned with how one must act in order to truly be faithful to 'the Law and the Prophets'.
Within this context, we see that even when Jesus uses the phrase 'inherit the land', it should not be understand in an arbitrarily global sense, but within his historical context: an Israelite speaking to other Israelites, about who will inherit the land of Israel, and how they should act in order to do so.
While Matthew 5:5 echoes Psalm 37:11, it's not obvious that they have the same horizons, so I will take them one at a time and then offer a summary.
A canonical reading of Psalm 37:11 places the verse in the context of a number of Psalms about David (essentially 3-41). Psalm 37 itself is marked as "Of David" indicating that the primary referent should be David. Moreover, Psalm 37 contains strong overtones of Psalms 1 and 2. The author is waiting for the wicked to blow away like chaff (cf. 37:1-2, 1:4). The wicked meanwhile are plotting to overthrow the king, but God laughs at them (cf. 37:12-13, 2:1-4).
So when we read "The meek shall inherit the land/earth", we should have two contexts in mind:
First, the ascription on Psalm 37 means that we should have in mind the context of the Davidic covenant where the rule over Israel having peace in the land was promised to David and his son (see 2 Samuel 7:8-11). In this context, "land" in Psalm 37:11 refers to the land of Israel promised first to Abraham.
But second, because of the connection with Psalm 2 and the Davidide, we should also keep the programmatic context of Psalms 1 and 2 in mind. In doing so we should let the promise in 2:8 take its full effect, where the son of David is told "Ask of me and I will make the nations your inheritance, the ends of the earth your possession." In other words, in Psalm 37:11 the "land" should also be read in light of this promise of the ends of the earth as a possession.
Again, in Matthew 5:5, we should not let a single context control the meaning or we might needlessly narrow our interpretation.
The echo of Psalm 37:11 is certainly one context for Matthew 5:5. It propels us to think of the earth/land in terms of the land promised to Abraham. There are a number of other contexts that point in the same direction. John Nolland (NIGTC) notes, for example:
But there is another context as well to consider. Jonathan Pennington argues2 for the theme of heaven and earth as a key interpretive element in the Gospel of Matthew. Consider the following sample of verses (ESV):
Two particularly relevant instances are in the Lord's prayer and in the Great Commission:
We see in the prayer the kingdom of heaven coming to earth. And we see in the commission that all authority in heaven and earth was given to one man. Matthew highlights for a time the differences between the kingdom of heaven and the kingdoms of the earth, but the eschatological end of his gospel is that the kingdom of heaven is come to earth.
With this context, a reading of Matthew 5:5 in parallel with 5:3 and 5:10 and the promise of the kingdom of heaven, the statement that the meek will inherit the earth expands beyond the land of Israel to the kingdom of heaven come to earth.
On one horizon, the inheritance of the land in Psalm 37:11 pertains to a physical possession of the land of Israel by the Davidic king (possibly even David himself). But on another horizon, it also looks forward to the Davidic son's rule over the nations.
The beatitude in Matthew, however, is not pertaining to a literal referent, but a spiritual one in keeping with Matthew's distinction between the kingdom of heaven and the kingdoms of the earth. This is the case whether we are reading γῆ as meaning the "land" or the "earth." It brings in tones from these two ideas, but it reinterprets them in a spiritual way.
Finally, assuming that your question about the relationship between Jerusalem and this earth stems from a reading of Revelation 21, I'd encourage a second look at that passage. The heavenly city - the new Jerusalem - is also called the bride of the Lamb. And it is coming down from heaven to earth. Or in Matthew's terms: it is the kingdom of heaven being brought to the earth.
1 Nolland, John. (2005). Preface. In The Gospel of Matthew: A Commentary on the Greek text (p. 202). Grand Rapids, MI; Carlisle: W.B. Eerdmans; Paternoster Press.