The basic reason why a supply curve slopes upward is because producers want to make as much profit as they can. The fact that the supply curve slopes upward means that there is a direct relationship between the price at which the producer can sell their product and the quantity of the product that they can and will sell. This makes sense because a higher price will bring (all other things being equal) a higher profit. As the sale price of the good rises, the profit gained by selling it increases and the producer has a greater incentive to produce and sell a higher quantity.
Another way to look at this is that firms have to keep their marginal revenues equal to their marginal costs. This is an economic law because that is the way to maximize profit or minimize loss. Because of the law of diminishing marginal returns, marginal costs tend to increase as a firm produces more of a thing. When this happens, firms will need to charge higher prices so that their marginal revenue can continue to equal their marginal costs.
Thus, we have two main ways of explaining why a supply curve slopes upward.