A standard argument to deny possibility of inserting dimensionful quantities into transcendental functions is the following expression for Taylor expansion of e.g. $\exp(\cdot)$:
$$ e^x = \sum_n \frac{x^{n}}{n!} = 1 + x +\frac{x^2}{2} + \dots\,.\tag1$$
Here we'd add quantities with different dimensions, which you have already accepted makes no sense.
OTOH, there's an argument (paywalled paper), that in the Taylor expansion where the derivatives are taken "correctly", you'd get something like the following for a function $f$:
\begin{multline}
f(x+\delta x)=f(x)+\delta x\frac{df(x)}{dx}+\frac{\delta x^2}2\frac{d^2f(x)}{dx^2}+\frac{\delta x^3}{3!}\frac{d^3f(x)}{dx^3}+\dots=\\
=f(x)+\sum_{n=1}^\infty\frac{\delta x^n}{n!}\frac{d^nf(x)}{dx^n},\tag2
\end{multline}
and the dimensions of derivatives are those of $1/dx^n$, which cancel those of $\delta x^n$ terms, making the argument above specious.
In this technique you can put all variables which you think will affect time. Here, Prof. has assumed that the time taken by apple to reach the ground may depend on $h$, $m$ and $g$. Let's see on what it depends, we already have as assumed,
$t \propto h^\alpha m^\beta g^\gamma $
$ \therefore t = c \; h^\alpha m^\beta g^\gamma \qquad \text{where} \; c \;\; \text{is} \; \text{constant} \qquad \dots \dots (1)$
Putting the dimensions of $ t, h, m, g$ in above equation,
$ [T^1] = [L^1]^\alpha [M^1]^\beta [L^1 T^{-2}]^\gamma \quad c \; \text{is dimensionless}$
$ \therefore [T^1] = [L^{\alpha+\gamma}][M^\beta][T^{-2\gamma}]$
comparing the powers, we get,
$ \alpha + \gamma = 0 , \quad \beta=0, \quad \gamma = \frac{-1}{2}$
$ \Rightarrow \alpha = \frac{1}{2} $
Putting the value of $ \alpha,\; \beta\; \text{and} \; \gamma$ in equation $(1)$, we obtain
$ t = c \sqrt{\frac{h}{g}} $
Here, you can observe, how mass is out of the equation. Similarly, dimensional analysis provides you the power to assume that a quantity $x$ depends on $y$ $z$ $\dots$ At the end you will be left out with only those quantities, on which $x$ depends.
Best Answer
The argument is that the time it takes the apple to fall must depend on the height, because that's common sense. But we don't know how $t$ varies with $h$. For example we could have:
$$t \propto h$$
or
$$t \propto h^2$$
or
$$t \propto h^{\frac{1}{2}}$$
and so on. So the lecturer is saying, because we don't know how t depends on h let's just put:
$$t \propto h^{\alpha}$$
and then we'll use dimension analysis to calculate $\alpha$. Likewise the lecturer is assuming that mass and gravity are also important, and again we don't know how the time depends on them, so he's putting them in to the power $\beta$ and $\gamma$ and then he'll calculate what $\beta$ and $\gamma$ are. That's why you get:
$$t = h^\alpha \times m^\beta \times g^\gamma$$
The cunning trick is that $h$ has units of length ($L$), $m$ has units of mass ($M$) and $g$ (an acceleration) has units of length per second$^2$ ($LT^{-2}$), and of course time has units of time ($T$). If we put these into our equation we get:
$$T = L^\alpha \times M^\beta \times (LT^{-2})^\gamma$$
The only way this can be true is if $\beta = 0$, $\gamma = -\frac{1}{2}$ and $\alpha = \frac{1}{2}$ i.e.
$$t \propto \sqrt{\frac {h}{g}}$$
However there is a sneaky trick here, and I remember this annoyed me when I was first learning about dimensional analysis. The analysis gives you three simultaneous equations for $M$, $T$ and $L$, so when you have three variables like $\alpha$, $\beta$ and $\gamma$ you can solve the simultaneous equations and find $\alpha$, $\beta$ and $\gamma$. But suppose you put in a fourth parameter to the power $\delta$. Then you have four unknowns and only three equations and you can't solve them.