Lack of martial weapon proficiency
Just by their stats, a longbow does seem strictly better than a light crossbow.
However, longbows are martial weapons, and light crossbows are simple weapons. (PHB, p. 149)
As a result, some classes/races will not be able to use longbows effectively due to their lack of proficiency with martial weapons - in particular classes without Extra Attack often lack martial weapon proficiency.
As an example, a Human Rogue cannot wield a longbow with proficiency (barring feats). For this character, a light crossbow is one damage die better than a shortbow (which is also a simple weapon). Since they are a Rogue, they do not get Extra Attack, and so the fact that the shortbow can benefit from Extra Attack while the crossbow cannot (Loading property) does not come into play.
It's worth noting that a character who does have martial weapon proficiencies will likely be choosing between a heavy crossbow (which does more damage per attack) and a longbow (which works with Extra attack).
Crossbows are better weapons than longbows underwater, due to their lack of disadvantage.
From the rules on underwater combat (PHB p.198):
A ranged weapon attack automatically misses a target beyond the weapon’s normal range. Even against a target within normal range, the attack roll has disadvantage unless the weapon is a crossbow, a net, or a weapon that is thrown like a javelin (including a spear, trident, or dart).
Longbows and heavy crossbows both possess the Heavy property:
Small creatures have disadvantage on Attack rolls with heavy Weapons. A heavy weapon’s size and bulk make it too large for a Small creature to use effectively.
As a result, small characters will not want to use this kind of weapon, and would choose a shortbow or light crossbow (depending on their class, as above) instead.