Discount rates are a way to compare the value of cash today with cash in the future [there are a number of other discount rates, including the rate that banks pay the Federal Reserve to borrow money; see here for more on the Federal Reserve discount rate]. The key insight behind discounting is that if you have cash today you could invest it and have more money in the future; so to compare money in the future with money today, you must discount the money in the future by the appropriate “discount” rate that adjusts for what you might have done with the money.
Corporations typically use discount rates to evaluate new projects; the firm must spend some money today (and possibly again in the future) and then will expect to earn a return in the future. To determine whether the project is profitable the firm calculates whether the future cash inflows (appropriately discounted) are greater than the cash outflows (also discounted).
For corporations the appropriate discount rate is typically the weighted average cost of capital; while you can read about this in extensive detail in corporate finance texts, the weighted average cost of capital, or WACC which is equal to the (% Debt * Debt Cost) + (% Equity * Equity Cost).
One intuition behind this equation is that the firm issues two broad classes of securities, debt and equity; investors who purchase these securities have an expectation about the rate of return that they will earn; the rate of return that investors earn is equivalent to the cost that the firm must pay to obtain these funds. In general, debt is more secure and has a lower expected rate of return than equity (to learn more about calculating the expected rate of return of equity you must understand asset pricing models, but for the moment you should be able to accept that there are ways to estimate the cost of equity for different corporations and the differences in the cost reflect the different risks of the riskiness of the corporations).
A second intuition behind this equation is that the appropriate discount rate is the average cost of capital for the firm; that is, the firm values all cash flows as if they had the same risk as the entire firm. If a company like Apple is designing a new product similar to their other products, they will use the firm’s WACC to evaluate its profitability. If a firm is doing something that is not typical of what they do (i.e., if Apple were to open a restaurant franchise), they might decide to use a cost of capital for a representative company (in Apple’s case, a restaurant company) to reflect the different risk of the restaurant business.
As in many aspects of life, the federal government calculates a discount rate, the AFR or Applicable Federal Rate, that must be used for certain types of calculations. See here for a description of how the AFR is calculated and when it should be used and see here for the current and historical values of the different AFRs.