In the definition of the continuous function on a metric space, it seems to me that a continuous function depends on the metric of the given metric space.
Could somebody explain Why the continuity of a function on a metric space doesn't depend on metrics?
It does depend on the metric
except when the space is discrete. [I have struck through the words "except when the space is discrete" because if you change the metric the space could cease to be discrete.] What that means is that there exist functions that are continuous with respect to one metric on the underlying set and not with respect to another.It may be that you read some statement that was true in a specified context, to the effect that it doesn't depend on the metric. Probably it said that among all metrics that induce the same topology, continuity does not depend on which of them is used.
As a simple example, one metric says the distance between two real numbers $x,y$ is $|x-y|$. Another says it is $|\arctan x-\arctan y|$. Both induce the same topology, i.e. the same set of all open sets. Among all metrics that induce that particular topology, all have the same collection of continuous functions whose domain is the set of real numbers.