Hi there. an economics teacher here. the main ways the competition policy and market failure are linked are not related to the environment, which people tend to assume is the main/only form of market failure. remember that market failure is any failure of the price mechanism to achieve an efficient outcome. There are many examples of market failures that have nothing to do with the environment or greenhouse gases from excessive cow farts.
Here's a pretty simple one: when firms have monopoly power or significant market power. A monopoly will restrict supply (because they can) to drive the price up, which obviously hurts consumers. This under-provision of goods is a market failure because the most efficient outcome (production where D=S) is not achieved. which can be corrected by competition policy which seeks to reduce the market power of monopolies or even oligopolies. E.g ending the two-airline policy in Australia does this.
Any circumstance in which competition is reduced because of the market power of firms (or indeed consumers in extreme cases), can lead to a market failure. Most competition policy that you would have studied fundamentally tries to empower the weaker players in the market so a more efficient outcome is achieved.
Hope that helps