The quoted Gemara Taanis 20a states regarding the reed:
אֲחִיָּה הַשִּׁילוֹנִי קִלְּלָן בְּקָנֶה, אָמַר לָהֶם לְיִשְׂרָאֵל: ״וְהִכָּה ה׳ אֶת יִשְׂרָאֵל כַּאֲשֶׁר יָנוּד הַקָּנֶה״, מָה קָנֶה זֶה עוֹמֵד בִּמְקוֹם מַיִם, וְגִזְעוֹ מַחְלִיף וְשׇׁרָשָׁיו מְרוּבִּין, וַאֲפִילּוּ כׇּל הָרוּחוֹת שֶׁבָּעוֹלָם בָּאוֹת וְנוֹשְׁבוֹת בּוֹ — אֵין מְזִיזוֹת אוֹתוֹ מִמְּקוֹמוֹ, אֶלָּא הוֹלֵךְ וּבָא עִמָּהֶן. דָּמְמוּ הָרוּחוֹת — עָמַד הַקָּנֶה בִּמְקוֹמוֹ.
Rabbi Yoḥanan elaborates: Ahijah the Shilonite cursed the Jewish people by comparing them to a reed: “For the Lord will smite Israel as a reed is shaken in the water.” Although it seems to be a curse, this verse is actually a blessing. Just as this reed stands in a place of water, and its shoots replenish themselves when cut, and its roots are numerous for a plant of its size, and even if all the winds in the world come and blow against it, they cannot move it from its place, rather, it sways with them until the winds subside, and the reed still stands in its place, the same applies to the Jewish people. After all the difficulties that they endure, they will ultimately survive and return home.
Regarding the cedar tree gemara continues
אֲבָל בִּלְעָם הָרָשָׁע בֵּירְכָן בְּאֶרֶז, שֶׁנֶּאֱמַר: ״כָּאֲרָזִים עֲלֵי מָיִם״, מָה אֶרֶז זֶה אֵינוֹ עוֹמֵד בִּמְקוֹם מַיִם, וְאֵין גִּזְעוֹ מַחְלִיף, וְאֵין שׇׁרָשָׁיו מְרוּבִּין. אֲפִילּוּ כׇּל הָרוּחוֹת שֶׁבָּעוֹלָם נוֹשְׁבוֹת בּוֹ — אֵין מְזִיזוֹת אוֹתוֹ מִמְּקוֹמוֹ. כֵּיוָן שֶׁנָּשְׁבָה בּוֹ רוּחַ דְּרוֹמִית — עוֹקַרְתּוֹ וְהוֹפַכְתּוֹ עַל פָּנָיו. וְלֹא עוֹד אֶלָּא שֶׁזָּכָה קָנֶה לִיטּוֹל הֵימֶנּוּ קוּלְמוֹס לִכְתּוֹב בּוֹ סֵפֶר תּוֹרָה נְבִיאִים וּכְתוּבִים.
However, Balaam the wicked blessed the Jews by comparing them to a cedar, as it is stated: “As cedars beside the waters” (Numbers 24:6). Just as this cedar does not stand in a place of water, and its shoots do not replenish themselves, and its roots are not numerous, Balaam wished that the same should apply to the Jewish people. Furthermore, while it is true that even if all the winds in the world blow against it they will not move it from its place, once the southern wind blows against it, it uproots the cedar and turns it on its face. And not only that, but the reed merited that a quill [kulmos] is taken from it to write with it a Torah scroll, the Prophets, and the Writings. Evidently, the curse comparing Israel to a reed is better than the blessing likening them to a cedar.
The simple understanding of the story is that the reed naturally grows in water which usually protects a reed from all winds. The winds may cut the reed stems, but do not uproot it, since the roots are hidden under water; so that the plant regrows itself. Cedar trees mostly grow in Lebanon mountains, where the trees are protected from the heat of the southern wind from the Negev desert. Cedar trees do not grow near water as implied by Bil'am, because the tree roots need air, and the soil saturated with water does not have enough air for the roots. Such a tree will not develop well.
There are several symbolic comparisons that come to mind for reed and cedar. The simplest is comparison by size: a lowly reed against a tall cedar, i.e. humility vs. pride as it is done by Rashi on Vayikra 14:4: This lofty tree was used because plagues come also as a punishment for haughtiness (cf. Arakhin 16a). Also Rashi on Bamidbar 19:22:
עץ ארז ואזוב ושני תולעת CEDAR WOOD AND HYSSOP AND CRIMSON — These three species correspond to the three thousand men who fell by the edge of the sword on account of the golden calf. The cedar is the loftiest of all trees and the hyssop the lowliest of all — a symbol that the man of high position who displays pride and on that account falls into sin should make himself as lowly as the hyssop and the worm (תולעת), and he will then gain atonement.
The second comparison comes from Pirkei Avos 3:17 where Rabbi Elazar ben Azaria says:
הוּא הָיָה אוֹמֵר, כָּל שֶׁחָכְמָתוֹ מְרֻבָּה מִמַּעֲשָׂיו, לְמַה הוּא דוֹמֶה, לְאִילָן שֶׁעֲנָפָיו מְרֻבִּין וְשָׁרָשָׁיו מֻעָטִין, וְהָרוּחַ בָּאָה וְעוֹקַרְתּוֹ וְהוֹפַכְתּוֹ עַל פָּנָיו, שֶׁנֶּאֱמַר (ירמיה יז) וְהָיָה כְּעַרְעָר בָּעֲרָבָה וְלֹא יִרְאֶה כִּי יָבוֹא טוֹב וְשָׁכַן חֲרֵרִים בַּמִּדְבָּר אֶרֶץ מְלֵחָה וְלֹא תֵשֵׁב.
אֲבָל כָּל שֶׁמַּעֲשָׂיו מְרֻבִּין מֵחָכְמָתוֹ, לְמַה הוּא דוֹמֶה, לְאִילָן שֶׁעֲנָפָיו מֻעָטִין וְשָׁרָשָׁיו מְרֻבִּין, שֶׁאֲפִלּוּ כָל הָרוּחוֹת שֶׁבָּעוֹלָם בָּאוֹת וְנוֹשְׁבוֹת בּוֹ אֵין מְזִיזִין אוֹתוֹ מִמְּקוֹמוֹ, שֶׁנֶּאֱמַר (שם) וְהָיָה כְּעֵץ שָׁתוּל עַל מַיִם וְעַל יוּבַל יְשַׁלַּח שָׁרָשָׁיו וְלֹא יִרְאֶה כִּי יָבֹא חֹם, וְהָיָה עָלֵהוּ רַעֲנָן, וּבִשְׁנַת בַּצֹּרֶת לֹא יִדְאָג, וְלֹא יָמִישׁ מֵעֲשׂוֹת פֶּרִי:
He used to say: one whose wisdom exceeds his deeds, to what may he be compared? To a tree whose branches are numerous but whose roots are few, so that when the wind comes, it uproots it and overturns it, as it is said, “He shall be like a bush in the desert, which does not sense the coming of good. It is set in the scorched places of the wilderness, in a barren land without inhabitant” (Jeremiah 17:6).
But one whose deeds exceed his wisdom, to what may he be compared?
To a tree whose branches are few but roots are many, so that even if all the winds in the world come and blow upon it, they cannot move it out of its place, as it is said, “He shall be like a tree planted by waters, sending forth its roots by a stream. It does not sense the coming of heat, its leaves are ever fresh. It has no care in a year of drought; it does not cease to yield fruit” (Yirmiyahu, 17:8).
The third comparison is that the merit of the Torah study even in exile is greater than the merit of the Beis haMikdash which was made out of cedar wood as discussed here. Water is reference to Torah as in Bava Kamma 82a:
דְּתַנְיָא: ״וַיֵּלְכוּ שְׁלֹשֶׁת יָמִים בַּמִּדְבָּר וְלֹא מָצְאוּ מָיִם״ – דּוֹרְשֵׁי רְשׁוּמוֹת אָמְרוּ: אֵין מַיִם אֶלָּא תּוֹרָה, שֶׁנֶּאֱמַר: ״הוֹי כׇּל צָמֵא לְכוּ לַמַּיִם״.
As it is taught in a baraita with regard to the verse: “And Moses led Israel onward from the Red Sea, and they went out into the wilderness of Shur; and they went three days in the wilderness, and found no water” (Exodus 15:22). Those who interpret verses metaphorically said that water here is referring to nothing other than Torah, as it is stated metaphorically, concerning those who desire wisdom: “Ho, everyone who thirsts, come for water” (Isaiah 55:1).
The southern wind is a reference to the valley of Ben Hinom, which was in the south-west, where the during the First Temple people made child sacrifices. As we also know, the south-west corner of the altar belonged to the territory of Shevet Yehudah, and from that part the fire and the destruction went to the whole of the Temple.
Finally, the Torah study provides greater protection than a cedar tree for a messenger of the Angel of Death as one can learn from Gemara Makkos 10a:
וְאִי בָּעֵית אֵימָא, מַאי קוֹלְטִין – מִמַּלְאַךְ הַמָּוֶת. כִּי הָא דְּרַב חִסְדָּא הֲוָה יָתֵיב וְגָרֵיס בְּבֵי רַב, וְלָא הֲוָה קָא יָכֵיל שְׁלִיחָא [דְּמַלְאֲכָא דְּמוֹתָא] לְמִיקְרַב לְגַבֵּיהּ, דְּלָא הֲוָה שָׁתֵיק פּוּמֵּיהּ מִגִּירְסָא, סְלֵיק וִיתֵיב אַאַרְזָא דְּבֵי רַב, פְּקַע אַרְזָא וּשְׁתֵיק, וִיכֵיל לֵיהּ.
And if you wish, say: What is the meaning of Rabbi Yoḥanan’s statement that matters of Torah provide refuge? It means protection, but not for an unintentional murderer from the blood redeemer; rather, it means protection from the Angel of Death. This is as it was in this incident where Rav Ḥisda was sitting and studying in the study hall of Rav and the agent of the Angel of Death was unable to approach him and take his life because his mouth was not silent from his study for even a moment. The agent ascended and sat on the cedar tree of the study hall of Rav. The cedar tree broke and Rav Ḥisda was momentarily silent, startled by the sudden noise, and the agent of the Angel of Death overcame him. Apparently, matters of Torah provide protection from the Angel of Death only when one is actively engaged in their study.