You can’t get Infinity enchantment on a crossbow naturally in Minecraft. But you can use commands to add it. However, the crossbow still consumes ammunition.