The diameter of a lens is at least as large as the diameter of the largest element (almost always the front element though not necessarily so). The lens barrel, hood mountings etc. add a little bit to this diameter but aren't usually the determining factor.
The diameter of the front element must be large enough for the entrance pupil to be visible across the entire field of view.
The entrance pupil is the image of the aperture (a hole in the middle of the lens) as seen from looking into the lens from the front (thus taking the distorting properties of the glass in front of the aperture into account).
If the front element is not large enough for you to see the whole entrance pupil then that must mean light is being blocked, and the f-stop of the lens reduced as a result.
You can see this effect in practice when looking at real lens sizes. The size of the entrance pupil is given by the focal length divided by the f-number. Take a 600 f/4 lens. It has entrance pupil of size 600 / 4 = 150mm the datasheet for the Canon 600 f/4L lens states the lens max diameter to be 168mm (this includes the lens barrel and hood mount, I couldn't find figures for the actual size of the front element, but it's about right).
A 135 f/2 lens has an entrance pupil of 67.5mm, the Canon 135 f/2.0L has a filter diameter (again slightly larger than the front element) of 72mm. All good. But now look at a 14mm f/2.8 lens, entrance pupil of just 5mm, yet the diameter is quoted at 77mm, a huge disparity.
This is where entire field of view part of the definition above is important, it's not good enough to be able to see the entrance pupil head on, but not from the side, that would result in light falloff across the frame. Imagine looking through a drainpipe, when viewed head on you can see right through, but when viewed from an angle the light at the other end is quickly blocked. A flared drainpipe with one end much larger than the other wouldn't suffer from this problem.
A telephoto lens has a very narrow field of view, pretty much anything in shot will be viewing the lens head on, so the front element only needs to be slightly bigger than the entrance pupil, hence the good correlation with the sizes quoted above. A wide angle lens can image objects to the side, and hence the "flared drainpipe" approach is required, necessitating a much larger front element and larger diameter lens.
For telephotos lens diameter is determined by the size of the entrance pupil (focal length/f-number), for wideangle lenses it is more or less determined by the field of view (though size and position of the entrance pupil play a part).