Why is $\pi$ irrational if it is represented as $C/D$?

A rational number is a number that can be expressed as $p/q$, where $p$ and $q$ are integers. The number $\pi$ cannot be expressed in this form; hence it is irrational.

In other words, the definition of "fraction" does not include ratios like "circumference/diameter" in which the numerator and denominator are arbitrary numbers, not necessarily integers. In the case of "circumference/diameter" (which you denoted $\pi = C/D$), it will always be the case that if the diameter is an integer, the circumference ($C = \pi D$) is not an integer, and if the circumference is an integer, the diameter ($D = C/\pi$) is not an integer: precisely because $\pi$ is irrational.

Note that a definition of "fraction" that allowed arbitrary real numbers as the numerator and denominator would be not very useful, as it would allow "fractions" like $\pi = \pi / 1$, or indeed, for any number $x$, the representation of $x$ as a "fraction" $x = x/1$.


A number is called rational when it can be represented as $m/n$, where $m$ and $n$ are both integers.

Irrational numbers are the ones that are not rational, ie. cannot represented as a fraction $m/n$ where $m$ and $n$ are both integers. It is possible to prove that $\pi$ is irrational.

If we defined rational numbers as numbers that can be represented as $C/D$, where $C$ and $D$ can be any real numbers, then every number would be rational: $X = X/1$ for every $X$.