I see no reason why an animal companion couldn't be polymorphed like anything else, and I don't see why there should be a limitation such as that it can't exceed the HD of the druid.
However, if you polymorph the animal companion into something that doesn't qualify as an animal companion, then it ceases to be an animal companion (compare to awaken).
I'd probably let the animal revert to being an animal companion once it shifts back into an animal, unless "too much" time has elapsed, but that's campaign-world dependant, i.e. not specified by the rules, as far as I can tell.