it refers to different things
you can say "in the beginning of the lecture, i thought that X plus Y equal Z, but know i know it's 2B." or "at the beginning of the book, we get to know the main characters, the setting, and the time when the lot happens." basically, the IT and AT refer to what you're talking about.