Chest that has it's loot table works fine using /setblock, but doesn't work if you give it yourselves using /give.
:info: Important is to note that it is NOT a feature suggestion. I saw it somewhere and it worked fine. Did exactly the same and didn't work.
This is because the NBT tags for setting a block with a loot table and giving an item with a loot table are different. For a block it is: /setblock ~ ~ ~ minecraft:chest{LootTable:"name"} and for an item it is /give @p minecraft:chest{BlockEntityTag:{LootTable:"name"}}. If you need help with commands, I can recommend this website: https://mcstacker.net