Pontificating hasn't always been a bad thing. Once, it simply meant performing the duties of a pontiff or a bishop. The sense of pompously pronouncing on a topic is only a little more than a century old.
The high priest of antique Rome was known as the Pontifex Maximus. It was a position held by, among others, Julius Caesar. When Christianity got the upper and whippier hand, it simply took the title for itself, which means that the Pope goes back in a direct line of succession to Caligula.
Pontifex probably meant bridge builder, but nobody is sure.