The Great Barrier Reef received its European name on 11 June 1770, when Lieutenant James Cook (not yet Captain) commanding HMB Endeavour ran aground on Endeavour Reef (near present-day Cooktown, Queensland).
Cook wrote in his journal: "...the great barrier reef..." (lowercase, descriptive). The name "Great Barrier Reef" was formalized by later cartographers (Matthew Flinders, 1802–03 surveys) and the British Admiralty.
Aboriginal and Torres Strait Islander peoples have known, named, and navigated these reefs for 60,000+ years. Guugu Yimithirr call the area Gangaar; other groups have distinct names for specific reefs, channels, and totemic sites. Cook's "discovery" was a European naming event, not a human discovery.
The name stuck because the reef is a great barrier—protecting the coast, challenging navigation, and harboring unparalleled life.