I came across this explanation and don't understand how the equation came to be.
Let I represent the amount of money deposited in bank, r the interest rate (compounded) and t represent time.
Then the value of risk-free investment increases as $I(t+dt) = I(t)+dI$
So far so good.
And then it says that that $dI = rIdt$ provided $dt$ is any small finite increment.
Why is it rIdt? Why multiply I by r? Shouldn't it rather be $((r+1)^{dt}-1)I$ since we're talking about compounded interest?
The textbook then goes on about solving the separable first order differential equation and ending up with the solution $I(t) = I_0 e^{r(t-t_0)}$
"Why is it $\boldsymbol{rIdt}$"
Let's make this simple. Using your notation you have $I$ amount of money deposited. Now, how much money would you have after one unit of time (this could be months, days, years, whatever)? This would be
$$I_{new} = I + rI$$
$I$ is what you start with and $rI$ is the amount of money you gained after just one iteration in time (one interest period). You can also call $rI$ the amount of money your account changed. It is common to represent this change in mathematical terms using a capital delta ($\Delta$). So,
$$\Delta I = rI$$
after unit time. Now, what if we want to know how the account changes over a finite time period? The interest rate, which has units of time$^{-1}$, needs to be multiplied by $\Delta t$ to give the effective rate of interest over that time period.
$$\Delta I = rI\Delta t$$
The last step is to make these changes be infinitesimally small, so we now use the notation of differential calculus
$$dI = rIdt$$
This equation is already in separable form but can be "rearranged" to be a differential equation in time if so desired
$$\frac{dI}{dt}=rI$$
Solving this differential equation: We will do this using the separable equation as it is simpler and a neat trick.
$$dI=rIdt \implies \frac{dI}{I}=rdt$$
Now integrate both sides with respect to their indicated variables
$$\int_{I_0}^{I_t}\frac{dI}{I}=\int_{t_0}^trdt \implies \ln\left(\frac{I_t}{I_0}\right) = r(t-t_0)$$
Here I use $I_t$ equivalently as $I(t)$ for notation elegance. Now the rest is algebra to obtain the result your textbook provides
$$\boxed{I(t) = I_0e^{r(t-t_0)}}$$