The short answer is there's a lot of overlap between them because they perform the same function (nominalisation).
There are some areas of exclusivity, especially when describing 'what you experience' or 'are aware of'.
There's so much to say about this topic. Can I link you to here where I explain the difference? The historical evolution of these nominalisers help describe their differences and the reason for overlap between them.
A brief summary is as follows:
ㅁ is the least productive nominaliser in Modern Korean and has certain nuances. ㅁ tends to have the following characteristics:
- tends to be used with completed actions,
- tends to nominalise abstract thoughts and ideas,
- tends to denote entities of knowledge and belief (from a universal perspective),
- used in many fossilised nouns,
- used more often than 기 and 것 in bullet points and has the nuance of demanding compliance,
기 is still a productive nominaliser and has the following characteristics:
- tends to be used with activities, processes and states,
- tends to be used with (unfinished) actions and states where time isn’t a consideration,
- used in a large number of grammatical constructions,
- used infrequently in (spoken) sentence endings, where it solicits co-operation with an indirect force,
- used commonly in bullet points, where it’s mostly used for actions and processes,
As the dominant nominaliser, 것 doesn’t have particular usage, unlike ㅁ and 기 which have been downgraded to certain characteristics. There isn’t much to say other than:
- tends to be avoided when 기 and ㅁ are more appropriate (which are fuzzy boundaries),
- used freely with almost any verb,
- used with the most flexibility,
- used rarely in bullet point endings.