Strictly speaking - there is no proper way to do this. It depends on your problem and more specifically - what you know about your dataset and what you are trying to achieve.
If, for example, in your type of dataset each sample can have different mean for technical reasons, like the amount of DNA used to measure gene expression, then subtracting the mean from each sample would make them more comparable to each other. However this procedure also carries a downside: it might be unreasonable for you to assume that the total amount of expression is the same in all samples.
On the other hand subtracting a mean from each feature (gene expression) would force all genes to have the same average level of expression. As a preprocessing step for the dataset - this in most cases is more unreasonable than subtracting means from each sample. However it might be done as a first step before applying some other procedure, like principal component analysis.
Now you specifically want to find the clusters of samples. It depends on how you will do this, but you will probably have to find distances between each pair of samples. So in this case:
Subtracting the means of each sample will make it so that the average gene expression within a sample have no influence on the output of your clustering result. This can be done to remove technical noise. But can also reduce real differences between samples. If you suspect technical noise to have a bigger influence on average sample expression compared to real differences - subtracting the mean is probably a reasonable step.
Subtracting the means of each feature will make it so that the differences in average expression between genes will have no effect on your clustering result. After this each gene will carry a more similar weight to the final between-sample distance measure. And would reduce the "background" similarity in cases where the average expression of each gene is very similar across all samples.