Why is heat capacity defined as a partial derivative?
I think you are starting on the wrong foot.

$U$ and $H$ are state functions. They both depend on several variables. $U$ is a function of entropy $S$ and volume $V$ and composition. For a pure fluid there is no dependence on composition, so we can just say $U = f(S,V)$. Similarly $H$ is a function of entropy and pressure $p$ i.e., $H=f(S,p)$. You go from U to H by using a Legendre Transform (but ignore Legendre Transforms for now... I will give you a good reference to read for thermodynamics at the end, it will make your life better).

Important

Reality has a way of changing things. For instance experiments are done almost always at a constant $T$, and either constant $p$ or $V$. Therefore, we like thinking of things in terms of these variables. Lets face it... entropy is tricky.

Assumption

Okay, lets now say that $U=f(T,V)$ and $H=f(T,p)$ this is alot easier to handle. In thermodynamics we are always after changes in things. Therefore, the differential forms of $U$ and $H$ are desirable.

Also, this is not a haphazard switch, entropy and temperature are intricately related to each other $T \equiv \left( \frac{\partial U}{\partial S} \right)_{x's}$ where $x's$ are all other independent variables being held constant.

The differentials for both $U$ and $H$ are as follows (with respect to our new independent variables).

$$U(T,V)$$
$$dU = \left( \frac{\partial U}{\partial T} \right)_V dT + \left( \frac{\partial U}{\partial V} \right)_T dV$$
and
$$H(T,p)$$
$$dH = \left( \frac{\partial H}{\partial T} \right)_p dT + \left( \frac{\partial H}{\partial p} \right)_T dp$$

Endgame

It is here that we now define what $C_V$ and $C_p$ are

$$C_V \equiv \left( \frac{\partial U}{\partial T} \right)_V$$

$$C_p \equiv \left( \frac{\partial H}{\partial T} \right)_p$$

These are fundamental definitions and can't be tampered with. In introductory thermodynamics teachers play games and try to frankly dumb things down, and this leads to, in my opinion, improper definitions and understanding. This link provides a definition (without much context) that ties $Q$ into the mix.

If we insert these definitions into our differential equations we have

$$dU = C_V dT + \left( \frac{\partial U}{\partial V} \right)_T dV$$
and
$$dH = C_p dT + \left( \frac{\partial H}{\partial p} \right)_T dp$$

I leave it as an exercise, if you wish, to find the definitions for $\left( \frac{\partial U}{\partial V} \right)_T$ and $\left( \frac{\partial H}{\partial P} \right)_T$

Final Resource

Herbert B. Callen, Thermodynamics and an Introduction to Thermostatistics, 2nd Edition

The man called Callen

The Textbook