I will start by saying that I don't know enough about the life history of these creatures to give a legitimate, factual answer to how what I will call Medium Sized giant clams dwell in the wild, with our without a foot (and the attachment intact.)
My personal observation is that newly settled Giant Clams quickly burrow into the dead reefs or into living coral colonies so that their feet are not readily exposed. There mantle will open to collect sunlight, and presumably they filter feed whenever they are open and siphoning water.
At some size the giant clams do seem to become detached and free living but it seems like there are not a lot of medium sized clams living, attached or not, in waters I have swam around in. Lots of 5 inch or less clams are attached on rocks in the lagoons, and fewer offshore in the coral heads. I have concluded that the transition between attached and free living LARGE giants is a high mortality life stage for clams, but I don't have any experimental facts to back up my casual observations.
Except, this, small clams that are detached on the reef are generally found dead whereas their buddies that are sheltered inside of a rock or coral "nest" seem to be protected and able to live happily without predation.