That's because some people decided that the UK would be better off outside of the EU, not realizing how much they depend on free trade and movement for their essentials.
I mean I can't even blame those who voted to leave, they were not informed and convinced by a massive propaganda campaign. But I can blame the politicians that pushed ahead with it, even though it was based on a small majority vote in a non-binding and un-nuanced referendum. These politicians should have done better and they knew better, they of all people should be able to grasp the larger / longer term effects.
I mean some people voted to leave because they don't like eastern-Europeans, immigrants and refugees, not realizing they're a backbone of infrastructure. People don't like when "they tuk er jerbs", but they're not willing or able to drive a truck themselves.