Why do some nucleophiles attack at the carbonyl group while others at an alpha-carbon in ketones?
For starters, you shouldn’t call it a nucleophilic attack at the &#x3b1; carbon; it is a deprotonation (something quite different since the latter doesn’t access the carbon atom in any way).

The second thing to note is that both do indeed happen. However, the nucleophilic attack on the ketone is not productive: nothing will happen that creates a new product or a different pathway. The only productive result of hydroxide’s attack onto the carbonyl carbon in the long run is the re-elimintion of either of the geminal hydroxy groups to reform the carbonyl and we’re back at the start.

Please don’t stop thinking like this (‘what happens when $\ce{X}$ attacks $\ce{Y}$ rather than $\ce{Z}$?’) — it’s a great way to spot side reactions, alternative pathways, problems with functional groups etc.