Surah Al-'Ankabut 29:65
فَإِذَا رَكِبُوا۟ فِى ٱلْفُلْكِ دَعَوُا۟ ٱللَّهَ مُخْلِصِينَ لَهُ ٱلدِّينَ فَلَمَّا نَجَّىٰهُمْ إِلَى ٱلْبَرِّ إِذَا هُمْ يُشْرِكُونَ
And when they board a ship, they supplicate Allāh, sincere to Him in religion [i.e., faith and hope]. But when He delivers them to the land, at once they associate others with Him
Translation: Saheeh International
Tafsir
And when they board the ship they call on God making their supplications purely to Him in other words they do not call on any other besides Him suffering distress which only He is able to remove; but when He delivers them to land behold! they ascribe partners to Him
Excerpt from Tafsir al-Jalalayn, commentary on 29:65, via Quran.com. The reader has the full commentary and 9 more tafsirs.