Dissimilation of bilabial finals following Middle Chinese (法, 品, 凡) Middle Chinese syllables with the shape CVP where C is a bilabial stop and P is a bilabial underwent dissimilation to CVF, where F = P[-labial]. For instance, Baxter's reconstruction of 法 is *pjop, 品 is *phim, and 凡 is *bjom.

Why did this dissimilation only happen to syllables with bilabial initials and codas, and not syllables with coronal or velar initials and codas?

My pet theory is that they disappeared because they sound inherently funny. (Only kidding.)
It's not just Cantonese. In Taiwanese Minnan (which does also preserve the labial final -m, usually), the finals of 法、凡、品 have also become alveolar. Also, most Hakka varieties have made the final of 品 alveolar too.

This phenomenon is examined in p.258 under "Long-distance C..C effects", in the chapter on "Consonant-vowel interaction in Cantonese" by Moira Yip, part of collection of papers published in Studies in Chinese Phonology (1997) ed. Wang Jialing. There, it is argued that it is evidence of consonant-vowel segregation.

Labial dissimilation is among the features of Cantonese investigated in part 6 "Cantonese syllabary" of chapter 3 "Cantonese syllables and words" of Modern Cantonese Phonology (1997) by Bauer &amp; Benedict. 

This labial dissimilation in Cantonese affects vowels and labialised velar consonants (e.g. /w/, /kʷ/) too: the front rounded vowels /yː/, /œː/, /ɵy/ are disallowed after labial or labialised consonants as well as before final labial consonants; /ɔː/ and /uː/ also tend to be disallowed before final labial consonants.

Why is it labial dissimilation, and not coronal or dorsal dissimilation? There is acutally some indication that coronal dissimilation is happening between the vowel and final consonant in loanwords into Hong Kong Cantonese, e.g. with /ɔːn/ and /ɔːt/ becoming /ɔːŋ/ and /ɔːk/ respectively. There is already an exclusion of front non-high vowel (/ei/, /ɛː/, /œː/) and of mid /ou/ pairing with a labial or coronal coda consonant; this points to an emerging injunction of mid vowels in general being paired with coronal consonants, i.e. coronal dissimilation. The injunction of high vowels with dorsal consonants isn't quite what one would see as dorsal dissimilation though. See this paper for further details from these English-based loanwords.

Still, labial dissimilation far outweighs coronal and dorsal. This paper argues, based mainly on data from Taiwanese Minnan, that it is not principally markedness that motivates the rime phonotactics, but the phonetics of having unreleased final stops. The difference between vowels in their vowel-consonant transition is the reason why some need not dissimilate; they may diphthongise (adding an excrescent schwa in Taiwanese Minnan), change vowel quality, or even neutralise.

That explanation of course raises the following question: Why in Middle Chinese do all those syllables with labial initials and labial finals also have front vowels or front medials?