Our Gemara on Amud Aleph enumerates various obligations upon a father toward his son, including teaching him to swim. Rav Elyashiv (Divrei Aggadah, Devarim 14:9) asks, "Why did the rabbis specifically choose swimming when there must be many other hazards and skills to learn? Why not Mathematics to avoid being cheated or Self-defense in case of bandits?" Rav Elyashiv suggests that the Gemara chose swimming because of a double entendre. He explains that a piece of wood that floats on water is not called swimming. Swimming connotes the ability to purposefully move in any direction. A father must teach a son how to sometimes "swim against the tide," that is, not to succumb to peer pressure or mob psychology.
Similar to this idea, there is a comparable Gemara about Rabbi Akiva's experience being lost at sea (Yevamos 121a):
תַּנְיָא, אָמַר רַבָּן גַּמְלִיאֵל: פַּעַם אַחַת הָיִיתִי מְהַלֵּךְ בִּסְפִינָה, וְרָאִיתִי סְפִינָה אַחַת שֶׁנִּשְׁבְּרָה. וְהָיִיתִי מִצְטַעֵר עַל תַּלְמִיד חָכָם שֶׁבָּהּ, וּמַנּוּ — רַבִּי עֲקִיבָא. וּכְשֶׁעָלִיתִי בַּיַּבָּשָׁה, בָּא וְיָשַׁב וְדָן לְפָנַי בַּהֲלָכָה. אָמַרְתִּי לוֹ: בְּנִי, מִי הֶעֶלְךָ? אָמַר לִי: דַּף שֶׁל סְפִינָה נִזְדַּמֵּן לִי, וְכׇל גַּל וְגַל שֶׁבָּא עָלַי — נִעְנַעְתִּי לוֹ רֹאשִׁי.
Rabban Gamliel said: Once I was traveling on a boat, and from a distance I saw a boat that shattered and sank. And I was grieved over the apparent death of the Torah scholar who was on board. And who was it? Rabbi Akiva. But when I disembarked onto dry land, he came, and sat, and deliberated before me about halakha. I said to him: My son, who brought you up from the water? He said to me: A plank from the boat came to me, and I bent my head before each and every wave that came toward me. The waves did not wash me off the board, and I reached the shore.
One can imagine being lost in a vast ocean, needing to tread water, not knowing for how long, not knowing when or if a rescue will come. Therefore, here too, this Gemara can also be understood metaphorically. Rabbi Akiva, facing an overwhelming situation, found a way to cope minute by minute. He let the waves pass over him and took it one wave at a time.
Sometimes you need to go with the flow, and sometimes you need to swim against the tide. Both of these are necessary survival skills.