A budget deficit occurs when an entity (often a government) spends more money than it takes in. The opposite of a budget deficit is a budget surplus. Debt is essentially an accumulated flow of deficits. In other words, a deficit is a flow and debt is a stock.
An accumulated deficit over several years (or centuries) is referred to as the government debt. Government debt is usually financed by borrowing, although if a government's debt is denominated in its own currency it can print new currency to pay debts. Monetizing debts, however, can cause rapid inflation if done on a large scale. Governments can also sell assets to pay off debt. Most governments finance their debts by issuing long-term government bonds or shorter term notes and bills. Many governments use auctions to sell government bonds.
Governments usually must pay interest on what they have borrowed. Governments reduce debt when their revenues exceed their current expenditures and interest costs. Otherwise, government debt increases, requiring the issue of new government bonds or other means of financing debt, such as asset sales.
According to Keynesian economic theories, running a fiscal deficit and increasing government debt can stimulate economic activity when a country's output (GDP) is below its potential output. When an economy is running near or at its potential level of output, fiscal deficits can cause inflation.