Given distribution fo test statistics (under mean $\mu$)
$$ X \sim \mathcal N \left(\mu, \frac{\sigma^2}{n} \right) = \mathcal N \left (\mu, \frac{40^2}{10} \right)$$
Significance level
$$ \alpha = \mathbb P(\text{reject } H_0\mid H_0 \text{ true}) = \mathbb P(\bar{X}>842\mid\mu=830)=0.171$$
Power of test for alternative $\mu=850$:
$$ \beta(850) = \mathbb P(\text{reject } H_0\mid H_1 \text{ with } \mu=850)= \mathbb P(\bar{X}>842\mid \mu=850)=0.763$$
However when i try to do the calculation, I cannot get the same result. I must be doing some basic mistake, where is it?
My calculations: $$\mathbb P(\bar{X}>842\mid\mu=830) = 1 - \mathbb P(\bar{X} \leq 842\mid\mu=830)= 1 - \frac{842 - 830}{12.65}=0.051$$
Short answer: You have mainly started down the right track, but you are missing $\Phi$ in your equation (the CDF of the standard normal distribution): $$1 - \mathbb P(\bar{X} \leq 842|\mu=830)= 1 - \frac{842 - 830}{12.65}=0.051.$$ should be $$1 - \mathbb P(\bar{X} \leq 842|\mu=830)= 1 - \Phi\left(\frac{842 - 830}{12.65}\right)=.0.1714.$$
Long answer: Mistakes such as this one tend to arise from writing down too little and losing track of the thread of the argument.
It seems you are testing the null hypothesis $H_0: \mu = 830$ against the alternative $H_0: \mu > 830,$ assuming $n = 10, \sigma=40,$ and rejecting $H_0$ when $\bar X > 842.$
Then the significance level is $$\alpha = 1-P(\text{Rej }H_0\,|\,H_0\text{ True}) =P(\bar X > 842\,|\,\mu = 830) \\ =P\left(\frac{\bar X - \mu_0}{\sigma/\sqrt{n}}>\frac{842-830}{40/\sqrt{10}}\right) = P(Z > .9486) = 1-\Phi(.9486),$$ where $Z$ is standard normal.
Using R, in which standardization is not necessary, one has
for the significance level and
for the power of the test against alternative $\mu_a = 850.$ You may get slightly different answers by standardizing and using printed normal tables because of the rounding necessary in using the tables.
It is usually a good idea to make a rough sketch by hand, which can sometimes keep you from making gross errors. The figure below shows the density curve of $\bar X$ under the null hypothesis $(\mu_0 = 830$), and the orange curve shows the density curve for the specific alternative $(\mu_a = 850)$.
The vertical dashed line separates the rejection region (to the right) from the 'acceptance' region. The significance level is the area under the blue curve to the right of the vertical line; the power against $\mu_a = 850$ is the area under the orange curve to the right of that line.
Of course, you can't make such an accurate figure by hand, but with a little practice you can learn to make helpful sketches.
Note on notation: Many textbooks use the symbol $\beta$ for Type II error and $\pi$ for power.