BMI doesn't distinguish between weight by fat or weight by muscle mass. Someone with a lot of muscles and not a lot of fat can still have a high BMI
It works as a rough guide as it is easer to calculate than body fat percentage. Most people that go to the gym don't have much muscle; so unless someone is a dedicated bodybuilder or powerlifter it's good enough. You can tell just by looking at someone if they have large amounts of body fat!