Why bound of linear function is same as that of quadratic equation
$O$ only gives an upper bound; see also here. Clearly, $n^2$ is -- up to a constant factor -- an uppper bound for linear functions.

In fact, you can prove that


  $n^{k_1} \in O(n^{k_2})$ for all $k_1 \leq k_2$.


Together with


  $n^{k_1} + n^{k_2} \in O(n^{\max \{k_1,k_2\}})$ for all $k_1,k_2$


and the obvious


  $cn^k \in O(n^k)$ for all $c,k$,


you get a general version of your statement.