Is it really true that "if a function is discontinuous, automatically, it's not differentiable"?
Let's look at your function.
$$f(x) = \begin{cases} x^2, & \text{$x≤3$} \\ x^2+3, & \text{$x>3$} \end{cases}$$
Clearly, the only interesting point is when $x = 3$. So let's see differentiability at $3$. Then we look at
$$ \frac{f(3+h) - f(3)}{h} = \frac{(3+h)^2 + 3 - 3^2}{h} = \frac{3 + 6h + h^2}{h}.$$ As $h \to 0$ (from the right), you can see that this last term goes to $\infty$, and so the function is not differentiable at $3$.
If you think about it, this makes sense. The derivative gives the best local linear approximation, and the rate of change at $3$ isn't defined --- it's a jump discontinuity, and there is no tangent line there.
Do you now see where you went wrong?
Flagrantly ignoring your specific example: suppose a function $f$ is differentiable at a point $x$. Then by definition of differentiability:
$$\lim_{h\rightarrow0}\frac{f(x+h) - f(x)}{h}$$
must exist (and by this notation I mean the limits exist in both the positive and negative directions and are equal). Since the bottom of that fraction approaches $0$, it's necessary for the top also to approach $0$, or else the fraction diverges. But the top approaching $0$ is just the definition of $f$ being continuous at $x$. So a function that isn't continuous can't be differentiable.
So, your example fails to be differentiable for the same reason that it fails to be continuous, which is that top of that fraction tends to $3$, not $0$, when approached from the positive direction.
The problem is when you gave the derivative for $x \leq 3.$ What you gave is correct for $x < 3,$ but not for $x=3.$ Consider secant slopes to nearby points with one point fixed at $(3,9),$ which is what the definition of the derivative requires. Looking to the left, you get secant slopes that converge to $6$ as you approach the fixed point $(3,9).$ But looking to the right you get secant slopes that approach $+\infty$ as you approach the fixed point $(3,9).$