Yes. The ocean (सागरः or Sāgara) is named after Sagara (सगर), a king of Ikshvaku dynasty. He is the son of king Asita. Ocean on the earth is formed by one of his deeds i.e., he dug the bed of ocean. Sagara's stepmother gives poison to Sagara's mother Kalindi out of jealousy. She was also pregnant. They both go to a sage Chyavana. As he was born from toxicity, he is named as Sagara (सगर).
Quoting from Valmiki Ramayana (Balakanda, Ch. 70):
सपत्न्या तु गरः तस्यैः दत्तो गर्भ जिघांसया |
सह तेन गरेण एव संजातः सगरोइ अभवत् || १-७०-३७
sapatnyaa = by co-wife; tasyaiH = to her; garbha jighaamsayaa = for womb, ruination [for abortion]; garaH dattaH = poison, given; tena gareNa saha samjaataH = with that, poison, along with, who took birth; hence he; sagaraH abhavat = Sagara, became.
"Because he took birth along with the poison administered to his mother by her co-wife, he became Sagara, the emperor..." [1-70-37]
Here is the parable of Sagara's life.
There are a series of verses in the Sundara Kanda where the ocean god thinks that he should help the messenger of Rama, who is a descendent of Ikshvaku dynasty. It is because he was formed by a deed of King Sagara.
In Valmiki Ramayana, Sundarakanda, Ch. 1, sāgara, the ocean says:
While that best among vanaras, Hanuma, was flying, the god of ocean thought thus for the respect of Ikshvaaku dynasty: "If I do not help this best among vanaras Hanuma, I shall become prone to all kinds of ill-talk by those who want to speak against me. I was developed by Sagara of Ikshvaaku dynasty. This Hanuma who is helping a descendant of that dynasty should not become tired. I have to behave in such a way that Hanuma would take rest. After resting in me for a while, He can cross the remaining distance with comfort".
In chapter 31, Yuddhakanda of Valmiki Ramayana, Vibhishana suggests the same. The Vanaras ask Vibhishana a strategy to cross the mighty ocean. Then:
Hearing their words, the right minded Vibhishana replied as follows:
"It is apt if prince Rama seeks ocean as his refuge. This immeasurable great ocean was excavated by Sagara. Hence, this great ocean will be inclined to do the act for Rama, his kinsman".
It is mentioned in Goswami Tulasidas' Ramcharitamanas too. See here.
Further reference is found in the Brahma Purana chapter 8 about Sāgara named after the king Sagara.
प्रादाच्च तस्मै भगवन्हरिर्नारयणो वरम् |
त्प्रक्षयं वंशमिक्ष्वाकोः कीर्तिं चाप्यनिवर्तिनीम् || ५८
पुत्रं समुद्रं च विभुः स्वर्गे वासं तथाक्षयं |
समुद्राश्चार्घमादाय ववन्दे तं महीपतिम् || ५९
Lord Hari, Narayana granted him(Sagara) the boon that Ikshvāku's race will be everlasting and they would have unreceding fame. The lord said that the ocean will be known as his son and his residence in the heavenly world would be everlasting. Taking Arghya unto him ocean saluted the monarch. [58-59]
Is the ocean (sāgara) named after King Sagara or is it the other way round?
The above references prove that the ocean (Sāgara) is named after the Ikshvāku king Sagara and not the other way round.