In most cases, economists model a company maximizing profit by choosing the quantity of output that is the most beneficial for the firm. (This makes more sense than maximizing profit by choosing a price directly, since in some situations- such as competitive markets– firms don’t have any influence over the price that they can charge.) One way to find the profit-maximizing quantity would be to take the derivative of the profit formula with respect to quantity and setting the resulting expression equal to zero and then solving for quantity.
Many economics courses, however, don’t rely on the use of calculus, so it’s helpful to develop the condition for profit maximization in a more intuitive way.