He probably had plans to use it for some sort of Ender's Game crap but then realized that grok wasn't smart enough to do it.
More likely is that they took a bunch of good usernames to sell - if you pay for their most expensive subscription one of the features is that you can rent a better username now.
It's extremely unlikely Musk was personally involved in any way in the decision on the username.
The word Grok comes from the novel Stranger in a Strange Land where the main character is Valentine.