The budget constraint divides what is feasible from what is not feasible. You can use the model of consumer choice and take a look at what a consumer will do to optimize her utility or satisfaction when a constraint exists. To do this, you have to take a look at what happens when you put the indifference curves together with the budget constraint.
A consumer would, up to a point of satiation, try to consume so that she's on the highest possible indifference curve — that is, one farthest away from the origin. Each of the indifference curves has the same level of utility at all points along the curve, and the only way to be at a higher level of utility is to be on a higher indifference curve.
The following figure shows the budget constraint. Okay, now, look at three indifference curves (and associated consumption bundles on each curve):
Indifference curve I1: Lies entirely within the budget constraint and therefore is feasible. But would the consumer choose it? The answer is no, because higher levels of utility or satisfaction would be available by consuming right up to the budget line — all the areas above the indifference curve but within the constraint are still affordable, and all yield higher utility than any point on I1.
Indifference curve I2: Also has points that are inside the constraint —although some are outside it.
Clearly the consumer would prefer points on I2 to those on I1, because they all confer a higher level of utility. But even though some combinations on I2 are unfeasible, the feasible points all lie away from the budget constraint, meaning that utility is available, as long as we restrict ourselves to combinations of x1 and x2 that are away from the extremes.
Indifference curve I3: Has a multitude of unavailable points, but notice also that this has one very important available point — point D — which is exactly on the budget line (mathematically, you say that it lies on a tangent to the line). This point yields higher utility than any point on I1 or I2 and is feasible. Moreover, any other point on I3 yields the same satisfaction as D, but you can't afford it with your income or M.The optimal point is on an indifference curve tangent to the budget constraint.
When looking at utility given a budget constraint, the best available point must lie on an indifference curve tangent to the budget constraint, because that's when the consumer has spent to the last penny available and can get no more satisfaction.