I read that the tangency condition is not sufficient for optimality, and that one other condition is that the MRS must equal the slope of the budget line at an interior optimum. My confusion is that since MRS is the slope of an indifference curve, then wouldn't it automatically be equal to the slope of the budget line of the budget line is tangent to the indifference curve?
The tangency condition itself is the condition that the optimal point, for an interior optimum, is the point where the MRS must equal the slope of the budget line. So the second part of your question is true. It is at the tangent point where MRS equals the slope of the budget line. You've confused yourself with the second (sufficient) condition which, on the other hand, states that the utility function must be strictly quasi-concave in order for an interior optimum to exist. Hope this clarifies.
Below is an example where the tangency (point $A$) is not the optimum (assuming both $x$ and $y$ are "goods" so that more of either good is preferred to less). In fact, the optimum occurs at the corner (point $B$) where the indifference curve is not tangent to the budget line. This happens because the preference over $x$ and $y$ is not convex, which is manifested by a set of indifference curves that is concave to the origin.
We normally assume that preference is convex, which generates indifference curves that are convex to the origin. Think of this as a taste for variety: if I'm indifferent between 2 can of pop and 2 slices of pizza, then I will be strictly better off if I get a combo of 1 pop and 1 pizza than having only one of the goods.
A non-convex preference represents the opposite taste for variety. Suppose $x$ is pop and $y$ is coffee, and I, as most people, would prefer to have them separately than combined. Then my preference over pop and coffee would be non-convex.