In Norse lore, the name for the rainbow is Bifröst, and it is used as a bridge between our own world of Midgard and the gods' abode in Asgard. The color red at the top is a burning flame, which prevents the frost giants from crossing it. The guardian of Bifröst is Heimdall, son of Odin, who keeps constant watch over the world. During Ragnarok, the giants will finally manage to cross over the rainbow bridge, and it will shatter with their weight. There's apparently a school of thought maintaining that the bridge between Earth and Heaven was originally thought to be the Milky Way rather than the rainbow, but common association still identifies Bifröst with the colorful arch.
The rainbow is also featured in the Biblical book of Genesis. After the great flood (you know, Noah's Ark and all that), God placed the rainbow in the sky as a sign that He'd never flood the entire world again. It's a good thing we have the rainbow, then, because otherwise He'd probably be causing worldwide floods every other week. The big guy must have memory problems, but that's not surprising for someone His age.
So what about the pot of gold at the end of the rainbow? I'm not sure exactly how that started, but it seems to have originated in Europe, and is especially identified with Ireland. One possible origin is a story about a leprechaun who grants a wish to a poor couple, and when they wish for riches, he tells them that their prize is at the end of the rainbow. Since it's impossible to get there, they never actually get the money, which is the leprechaun's punishment to the couple for their greed. This page says that some versions of the legend say that only a naked man can claim the gold, which sounds like it could be another leprechaun trick. The identification of leprechauns and pots of gold with rainbows is now so culturally ubiquitous that it can safely be referenced in children's cereal commercials.