1:
In an age that long preceded modern means of artificial fertilization people needed compost or manure to fertilize their agricultural land. One way of creating this compost was to leave plants, greenery, grasses and so forth to rot until they became usable compost. With space at a premium there was an inevitable temptation to use the public domain (street, market etc) as the dumping ground for the vegetative material.
2:
Tanna Kamma of our mishnah lays down two rules in this regard. Firstly, the vegetation dump - which is a hazard in the public domain - belongs to the owner and the owner may be sued for compensation for any injury sustained by passers-by because of his compost heap. In this there is no great novelty and the ruling is just what we would expect it to be based on previous cases dealt with in this chapter.
3:
Secondly, anyone is entitled to take possession of the compost heap! At first glance it seems as if Tanna Kamma is contradicting himself: if Sara has dumped her compost in the street the compost belongs to her and she is therefore liable to pay compensation for injuries caused by it. If the compost belongs to Sara how can David come along and simply claim it as his own? But this is what our mishnah actually rules: "whoever claims it first achieves ownership".
4:
What has happened is that the sages have punished Sara for her unsocial act. It is axiomatic in Jewish jurisprudence that a Bet Din has the right to deprive an individual of something that belongs to him as a punishment and a deterrent: a fine, if you will. So, in our case, in order to deter people from taking the easy way out and using the public domain as their compost dump the sages deprive the owner of his possession. That means that the compost dump is now hefker, technically ownerless property. And another axiom in Jewish jurispridence is that if something is hefker anyone can claim ownership and "whoever claims it first achieves ownership."
5:
In our mishnah Rabban Shim'on ben-Gamli'el does not disagree with Tanna Kamma; he just extends the ruling. Tanna Kamma applied the ruling to compost; Rabban Shim'on ben-Gamli'el applies the ruling to any hazard left in the public domain: the person who left the hazard there may be sued for compensation for injuries sustained and the offending hazard becomes hefker and "whoever claims it first achieves ownership."
6:
We now come to the last clause of our mishnah which is a kind of "mirror-image" of the first clause. Another way of fertilizing one's land was, of course, to use animal dung. One would imagine that animal dung was rather plentiful in the public domain! (All those oxen, sheep, dogs, chickens and so forth that occupied us in the first two chapters of this Tractate were not wont to clean up after themselves!) So, animal dung in the public domain is hefker, technically ownerless.
7:
Here is a possible scenario: As Sam leads Dobbin through the public domain Dobbin leaves behind a token of his passing. David comes along, sees it and is delighted: since it is hefker he can just scoop it up and use it to fertilize the ground of his allotment. In order to indicate that he has claimed ownership of the dung David delicately moves it (our mishnah says that he turns it over). Now he rushes off the bring a spade and a wheelbarrow. Meanwhile along comes Sara. Sara - not looking where she is going, as is her right, as we learned in the first mishnah of this chapter - steps into Dobbin's mess, slips, falls and breaks her leg. Sara can sue David because he has laid claim to ownership of the dung which now constitutes a hazard in the public domain.

