What happened is that their spending eclipsed their revenue. The country was a mixture of Socialism and capitalism, but the major source of revenue for the government came from https://en.wikipedia.org/wiki/PDVSA
PDVSA which is a STATE RUN company.
Maduro ran the company into the ground with poor management, which historically happens when politicians attempt to become businessmen.
Politicians are typically only trained in the art of entertainment, and running a business requires logic, math, and a knowledge of economics, markets, and marketing in order to remain competitive. Maduro ruined PDVSA with terrible policies, over employing the state-controlled industry with poorly trained people in exchange for political favors. This priced the oil out of the market and revenue to the Venezuelan government plummetted. Venezuela was already in debt to pay for the freebie giveaways from previous years, trading national debt for political giveaways. In order to not default on their loans, Venezuela was forced to print money, leading to hyperinflation, which is essentially a huge tax on everyone with Bolivars. The Bolivar is now worth about 10% of its original value, which means people cannot afford the price of food. A 1 dollar bag of rice now costs ten Bolivars.
This is essentially what happened.
In fact, Venezuela is now forced to import oil, because the Venezuelan oil that is produced from the state-run policies is currently more expensive than imported oil from private free-market oil companies due to the fact that production has fallen way off and there is far less supply than demand.