I actually understood all the likelihood ratio test and the test statistic for the goodness of fit. The only thing I did not quite understand is that, how do you calculate the upper-$a$ quantitle at significant level $a=5$%?
I thought the significant level at $5$% would be the same as the $95$% confidence interval. But the $95$% confidence interval will be:
then, the upper bound for the 95% CI:
$0.7684+1.96*0.00047^{0.5}= 0.810891787$
which is nowhere near $5.99$. So where did I go wrong?


I did not try to follow your argument at the end about a confidence interval. It is not clear for what parameter you are finding a CI, and under what assumptions. Or whether you intend a one- or two-sided CI.
Following your text, the quantity
$$Q = \sum_{i=1}^4 \frac{(O_i - E_i)^2}{E_i}$$
is approximately distributed as $\textsf{Chisq}(\nu=2).$ So the critical value for a test at the 5% level cuts 5% from the upper tail of $\textsf{Chisq}(\nu=2).$ (There are conditions for this approximation, which you should check in your text.)
According to R statistical software, and also printed tables of the chi-squared distribution, this value is 5.99, as stated.
In the plot of the density function below, the area under the curve to the right of the dotted red vertical line is 5%. Large values of $Q$ correspond to poor fit. This is a right-tailed test. A value of $Q = 0$ would indicate perfect fit of observed counts to expected counts.
[Note: If you have a specific question about your 'derivation' of a CI, please clarify your goals and assumptions.]