With Tom and Bert, one of the three trolls encountered by Bilbo and the Dwarves on their eastward journey to the Lonely Mountain. He seems to have been the leader of the troll-band - at least, it was he who led them to the woodlands of Trollshaws, according to his companions. It was William's pocket that Bilbo tried to pick as his first act of 'burglary', an attempt that brought the entire expedition close to disaster. Luckily, Gandalf was able to trick William and his two companions into arguing together until sunrise, whereupon they all turned to stone.
The name 'William Huggins' seems a very remarkable and unlikely one for a troll. It seems to be a translation by Tolkien of the troll's 'real' name, as with the Hobbits, Dwarves, Rohirrim and so on, and the fact that it is recognisably English suggests that his original name was from a Mannish language. What William's name actually was, though, is a mystery. (By a curious coincidence, there was a real historical figure named William Huggins, a pioneering astronomer of the mid-nineteenth century, though it seems extremely unlikely that Tolkien's foul-mouthed troll would be based on this noted scientist!)