In a recent session a character who was under the influence of a Potion of Flying was turned into an ant by a hostile spellcaster. The DM rules that even though the potion's effect persisted and gave the ant a 60ft fly speed, the character could not use the fly speed because "an ant doesn't know how to fly and isn't intelligent enough to find out." He later clarified that the ant was specifically a worker ant and as such doesn't naturally fly in its life cycle.
I find this to be unconvincing. While polymorph states that "The creature is limited in the actions it can perform by the nature of its new form", the Fly spell or Potion of Flying isn't dependent on the natural form of the creature it targets to begin with. Ants are able to move of their own will and nothing in the spell description states that creatures need to learn how to use the fly speed they gain (after all, humans also cannot fly by nature).
I also find it problematic to assume that polymorph can render a character unable to use their buffs, even though it nowhere states that it interferes with other magical effects. I phrased the question in a nonspecific way, because this would just as much go for a potion that, say, allows the character to breathe fire or breathe underwater. The effect doesn't specify that the character needs any kind of special training or skill to use it, it does not involve spellcasting but describes a relatively straightforward physical action like breathing or moving.
Nonetheless, I also can see the point that certain actions or decisions could be expected to require a certain value of intelligence or wisdom to perform or conceive of. Is there any guidance on the rules as to how a character whose intelligence is reduced below human levels or whose form is changed to one with low intelligence can still act and which abilities beyond the natural and instinctive they can use? Is there anything about whether effects that give the character a new ability automatically imbue them with the knowledge of how to use them and whether this requires a minimum mental ability score to work?