Light Weight Airsoft BBs such as .20 gram will yield a higher velocity, however lighter BBs carry less momentum and are more prone to environmental disturbances such as wind.
Heavy Weight Airsoft BBs do not shoot as fast, however they pack more momentum and are less bothered by wind and air resistance. Keep in mind this is airsoft, a heavier BB will not make it so your BBs will fly straight no matter what, wind will be a factor no matter what. Typically, you will see higher shooting velocity guns shooting heavier BBs.
If you have a gun that shoots 400 fps with a .20 g BB and you put a .25 gram BB into it, that .25 gram will shoot at a lower velocity, however it will have the exact same amount of energy. So you may be thinking “Wow, the heavier the BB, the better”- well not always. You cannot effectively use a heavy .43 gram BB in an L.P.E.G. (low powered/cost electric gun) or in a gun that shoots 400 fps with a .20 g. There is a velocity chart that shows the distance of the BB traveled with the categories of BB weight and energy/velocity.
*Regardless of all of this information, airsoft BB weight is a preference, some users swear by using .20 gram BBs only. Others insist on using nothing less than .25 grams. It all depends on what you like and you have to get out there and experiment until you find out what BBs work best with your gun.