I agree with Basurero, but I'd like to add to it:

"at the beginning": you state the time, it's a specific moment.

"in the beginning": the exact moment isn't really specified, because it's about...