Surah Al-Ankaboot

29:65

فَإِذَا رَكِبُوا۟ فِى ٱلْفُلْكِ دَعَوُا۟ ٱللَّهَ مُخْلِصِينَ لَهُ ٱلدِّينَ فَلَمَّا نَجَّىٰهُمْ إِلَى ٱلْبَرِّ إِذَا هُمْ يُشْرِكُونَ

And when they board a ship, they supplicate Allah, sincere to Him in religion. But when He delivers them to the land, at once they associate others with Him

Tafsir 29:65

When the idolaters board ships and sail the ocean, they call out to Allah alone, sincerely supplicating to Him to save them from drowning. After Allah saves them from drowning, they return to their idolatry, calling out to their idols together with Him.