Because of the constant rule, $\frac{d}{dx}(k) = 0$, where k is any constant.

However in one of the practice problems: Differentiate integer powers (mixed positive and negative), I tried to apply the same and $\frac{d}{dx}(x) = 1$ instead of zero.
Can someone explain to me why it is 1 instead of 0 here?

The definition of a derivative here is: $n \cdot x ^{n-1}$.
Example: $f(x) = x^2$ $$\frac{d}{dx}(x^2), n=2 \\ \text{applying the definition of the derivative} \\ n \cdot x ^{n-1} = 2x^{2-1} = 2x^1 = 2x \\ \text{Now apply this rule to the variable in your question} \\ \frac{d}{dx}(x), \text{where $x = x^1$} \\ n = 1, n \cdot x ^{n-1} = 1 \cdot x ^0 = 1$$
The main point, $x$ is a variable. If $x$ was defined as a constant than it would be $0$.