A trade deficit can occur for a number of reasons, but typically a country has a deficit when it's unable to produce enough goods for its consumers and businesses.
For example, a country might have a limited amount of natural resources and as a result, needs to import raw materials such as lumber or oil to satisfy the country's demand for those commodities. Countries might also specialize in specific goods or industries.
For example, Canada exports seafood, oil, and lumber, while China exports electronics, clothing, footwear, and steel. A land-locked country would have no access to the sea and would need to import seafood to satisfy its' consumer demand.
As a result, a trade deficit isn't necessarily a bad sign for an economy. On the contrary, a deficit could be a signal that a country’s consumers are wealthy enough to purchase more goods than their country produces.