A firm competing in a perfectly competitive market is considered a price taker and is unable to set their own prices due to characteristics such as selling homogeneous goods with many buyers and sellers , therefore they must set the price of goods/services equal to the markets demand, which is a perfectly elastic curve meaning the market price will be the same at any outcome. As firms profit maximise when MC=MR, the output will be set when an upward sloping MC curve intersect with MR which in this case is also the demand curve as every additional unit sold sells for the same revenue. MC also intersect a firms average costs at its minimum point, therefore your equilibrium outcome in the long run is the point where both MC,AC and the demand curve intersect. (Diagram used)This equilibrium can be beneficial as it is considered allocative efficient when P=MC as the social value that buyers place on an item is equal to the supposed social cost of producing it and also productively efficient and firms produce on their MES (minimum efficient scale) and any firms wasted resources will be forced to leave the market.