Long story short; while Cook was the first European captain to find Hawaii, he was not under orders to claim the island, nor did he survive his encounter with the Hawaiians.
So many early navigators who came to the Pacific: like Cook, did not come to claim territories. So places like Tahiti were visited by Wallace, Cook (on three different voyages), Bligh, Bougainville, etc... Without anyone laying an effective claim to the islands. In part; Europeans recognized Polynesians as having Kings and therefor proper political systems and instead sought to curry favor with the individuals they believed to be in charge and form alliances with them- therefor Captains like Cook would give gifts like flags to enter into alliances with island leaders without laying effective claim to the islands.
It's really in the decades later that navigators began to plant flags en mass and claim islands for distant governments.
As has already been partially explained, Cook wasn't in search of colonies. There appears to be an assumption that European countries were all engaged in actively seeking conquest of overseas territories in a kind of empire building process, and that discovery of a territory would, therefore, lead to claiming and seizure of that land. The active acquisition of territory came much later, and then usually for strategic reasons to control or protect routes to existing territories. The Netherlands going to war with Britain in the early 19th Century, for example, led to Britain's seizure of the Cape, to protect the route to India. The French and Spanish seized territory in N.Africa at least partly as a continuation, in Spain's case, of the Reconquista, and as a measure to limit and stop the depredations of the Barbary Corsairs. The rest of Africa was mostly ignored, apart from the establishment, by local consent, of trading posts. It was only in the later 19th century that deliberate empire building really began.