The Bible doesn’t say specifically where the baskets came from, only that they had them.
The Greek word used in Matthew 14:20, 16:9; Mark 6:43, 8:19; Luke 9:17; and John 6:13 is kophinos, which was “a wicker basket,” (made of twigs or branches) originally containing a certain measure of capacity. This was a relatively small basket that could be carried on the back to hold provisions, it is believed that they were ephah size, about 3/5 bushel, (like a knapsack size.)
Since there were around 5000 people there, it’s hard to imagine that there were not at least 12 empty baskets around that they could borrow.