You can try to think of it as roles. All nouns in a sentence play some role. For example, in a sentence like "she told the secret to her friend", we have the person doing it, the content of her saying and person to whom she tells. In Japanese we show it by particles like が, を and に.
So when we want to say something like "it's convenient (to do something)", this "to do something" has to be somehow marked/attached. It's not the person, and not the target/content of our action, so neither が or を would fit it. This is more or less why it's used with に. And this connection doesn't always fit the same description. In case of any kind of movement or transfer, it's often described as destination/source, depending on direction. This can be stretched to existence too, we can say that something exist somewhere, some related to our action place. And in case of 便利 it's so too, but it would be odd to say that in a sentence like "this dictionary is convenient for looking things up" "looking up" is a destination/source of convenience. We might, but it would be quite shadowy and unclear.
This is more or less so for many other particles too. There are roles for a theme (は), means (で), and many others. This の is simply added to turn verbs into nouns, otherwise we wouldn't be able to attach a particle like に. However, it's probably important to mention that sometimes people leave such の completely and you can find sentences like 想像するに難くない.