Market failure is anything that causes the market system not to allocate resources efficiently.
Externalities are a transaction between two parties or action that somehow affects a third party which has nothing to do with the original transaction or action.
There are both positive and negative externalities. For example a positive externality can be a nice garden that improves neighbours non-material living standards and improves their neighbourhood. A negative externality is something like pollution from a factory which is harming the environment.
It is a market failure for a few reasons (negative externalities are the main market failure while positive externalities are actually good for efficiency):
Economic agents don't consider externalities when producing consuming as they don't really have a reason too. I.e. positive externalities may not occur so often as people don't really pay attention to effects on third parties and negative externalities could often more often for the same reason.
Negative externalities can cause a wastage of resources as to fix the problem caused by them it is necessary to allocate resources to fixing them when those resources could have been used to improve the living standards and satisfy needs and wants (not just fix problems relating to externalities). E.g. More research funds spent on how to stop or reduce pollution when alternatively it could have been spent on research on how to increase life expectancy of people.
Governments have tried to fix this issue by adding extra taxes and other restrictions to things which cause negative externslities (e.g. Last years introduction of the price on carbon) and provide rebates for things which cause positive externalities (rebates on solar energy thingos, water tanks etc.).
Hope that made it a little easier to understand if someone has anything more to add, I too would like to know