Douglas Hare (Matthew, 2009, p 14) summarizes the common view of the gifts:
It was natural to associate gold with monarchy. Articles of gold have from earliest times been regarded as fit for a king (see I Kings 10:2, 25). Fragrant substances, often imported from distant lands at great expense, were also royal favorites. Myrrh appears on the gift list of I Kings 10:25. In [Song of Solomon] 3:6-7 we read that the king's litter was "perfumed with myrrh and frankincense." In addition to such function, myrrh was also employed in the high priest's anointing oil (Exod. 30:23-33). It is possible that royal oil contained the same ingredients. In this case it would have been particularly appropriate that the one to be known as "the Anointed One" (the Christ) should receive a gift of myrrh at his birth. According to Exod. 30:34, frankincense was employed in the holy perfume used in the sanctuary and nowhere else. [...] Another possible symbolic function of myrrh is suggested by John 19:39, where we read that Nicodemus brought "a mixture of myrrh and aloes, about a hundred pounds' weight," for the preparation of Jesus' body for burial. It is this use which prompted the view that the gift of myrrh in the Christmas story ties the Messiah's birth to his death.
Ian Boxall (Discovering Matthew, 2014, p 87) makes note of, what I think is, a likely textual allusion to Isaiah:
The text does not give us much to go on, apart from potential echoes of Isaiah 60, which would interpret two of them as the eschatological gifts of the Gentiles.
Trito-Isaiah, picking up on a common theme in the older prophetic books, depicts an idealized future when the nations of the world finally recognize the supremacy of Yahweh and bring gifts to Israel for being God's chosen people. It has been argued this concern was the major driving force behind the apostle Paul's career, and that it can also be found in the Synoptic Gospels (especially Luke). The relevant passage from Isaiah 60 reads:
Nations shall come to your light, and kings to the brightness of your dawn. Lift up your eyes and look around; they all gather together, they come to you [...] the wealth of the nations shall come to you. A multitude of camels shall cover you, the young camels of Midian and Ephah; all those from Sheba shall come. They shall bring gold and frankincense, and shall proclaim the praise of the LORD.
It may be a case of reading the popular conclusion back into the text, but if the magi are indeed meant to be 'kings', or at least represent 'the nations', it would give strong precedence to this connection.
Boxall continues:
The interpretation of the myrrh as a bitter-sweet anticipation of the passion of Jesus (found as early as Irenaeus, Adv. Haer. 3.9.2, and Origen Contra Celsum 1.60) connects with the artistic tradition, always ready to explore the connections between the magi story and Christ's suffering and death.
Amy Richter (Enoch and the Gospel of Matthew, 2012, p 190-192) offers a radically different perspective:
Many symbolic meanings have been attributed to these gifts and many biblical texts have been offered as possible references. [...] However, here I will focus on passages which have a potential connection with the Enochic template. The passage from Isaiah 60 just mentioned does share with 1 Enoch eschatological concerns. The gold and frankincense offered in this passage are part of "the first fruits of the eschatological pilgrimage of the nations and their submission to the one true God." [...] The connection between the magi's gifts and 1 Enoch is seen in the presence of frankincense and myrrh amongst the trees (1 En. 29:1) Enoch encounters on his journey to the Paradise of Righteousness (1 En. 28:1-32:6).
In other words, Richter makes a connection between the magi coming from the east with frankincense and myrrh, and Enoch discovering frankincense and myrrh as he journeys to the east.
Richter, drawing together a variety of sources (the Babylonian Talmud, Exodus, Esther), further argues that the forbidden arts the angelic Watchers taught to humanity in 1 Enoch included charms, cosmetics, and idolatry which made use of gold, frankincense, and myrrh. In her argument, the magi in fact continue the legacy of these forbidden arts, and so give to Jesus things they valued in their 'illicit skills':
The magi "see" the child and grasp his significance [...] As part of their worship of the child they offer gifts, each of which may be connected with the illicit arts taught by the watchers.