there are a few things that i can think of......
sometimes it will do that to try to move if it doesnt like the place where it is (like from not enough light, too much flow, or even bad water quality, ect.)
or if you are feeding it particals taht are to big such as oyster eggs, it can get clogged in the gills and kill the clam. it will cough to try to get some out.
are you sure that it is coughing and not just closing very quickly? if something is around it that will bother it such as a swaying coral or anenome, or a hermit or fish, or even if a fish swims over the top, the clam will close rapidly.
if you try to "force feed" the clam. if you inject something like phyto near it with a pipette, it will spit it back out to prevent chocking. clams like to feed over the period of a long time.