The gym business is big business and the success of gyms has contributed to weight training recommendations. While gyms have added "cardio" equipment to attract customers, gyms are primarily a place for body builders. Gyms may be fine for a light cardio workout, but these are not good places for endurance athletes to be. Unfortunately, most trainers and coaches work out of gyms or are affiliated with gyms or health clubs so they may feel compelled to help sell the product. Whatever the justification, I believe gyms and clubs are to be avoided as much as possible. Any kind of weight training builds bulk that is a nuisance to the endurance racer.
I have never done any weight lifting as part of endurance training and I do not plan to start now. I think it is a waste of time and can only have negative effects. Even if Ironman Dave Scott, "the man" disagrees. Dave Scott is naturally gifted and he can afford some extra bulk, but most of us mid-packers cannot.
Never fall for muscle building, high weight, low rep schemes that are favored by body-builders. I would advise to also stay away from low weight-high rep schemes that are supposed to mimic endurance exercise. Bicyclists and runners would do much better by riding or running hills with some extra resistance. For runners, dragging the old car tire up the hill is a much better workout, whereas bicyclists should try to ride high gears at a lower cadence. Swimmers can drag a small chute through the water. These may sound like old-fashioned methods, but they are tried and true and won't hamper you by developing unwanted muscle mass.
It goes without saying that one should do strength training. However, weight lifting is the worst kind of strength training an endurance athlete can engage in. It is a poor substitute for practicing your favorite sport in its natural environment. There are much easier ways that provide much better training. Adding weight to the bicycle, riding in high gears, climbing hills or battling headwinds, are all better ways to work out and build strength.