I didn't take part on the design of eighter machine, but my educated guess is that it was a historical decision:
A340 had initially ony a 4 bogeys main wheel, then larger series came on stock. To have commonalities as much as possible, they continued the bogeys and added some more wheels.
The 777 was a new design, so they could figure out that it was the best/lightest/most strongest design with 6 bogeys.