I think intelligence was inevitable in a lineage like the animals, but not in most lineages. Once you start having creatures with nervous systems and eventually brains, at least one of them is almost definitely going to take that trait to the extreme and evolve a HUGE brain like ours. Also, for any social life form, intelligence is an advantage, for communication, choosing mating partners, developing relationships with each other, "politics", etc. A social lifestyle in turn pushes species to become more intelligent, since the smartest ones will be best at these things and will reproduce more. The two reinforce each other, leading to ever greater intelligence, as has happened among the primates. And social lifestyles have evolved many times in the animal kingdom.
On the other hand, I don't think it's inevitable at all that organisms would have nervous systems in the first place. Animals are unique in that respect, and it would have been quite possible for animals to never evolve on Earth. There are so many other lineages of protists and bacteria besides the one that led to animals. And then there are fungi and plants. Can you imagine any of these groups evolving intelligence? It's not inevitable at all. Even multicellularity wasn't inevitable. Even eukaryotes weren't inevitable.