Why was the panama canal built to connect what?

The Panama Canal is an artificial, 82 km (51 mi) waterway in Panama that connects the Caribbean Sea to the Pacific Ocean.
Copyright Wanderlust World © https://www.ynyoo.com