The answer depends on a dozen philosophical discussions, and there's no consensus. Literally shelves full of books have been written on various answers to the topic. I can give you one particular answer, which is based on a relatively sound set of theories about how AGIs could gain consciousness, but it is definitely not the only one out there.
The one consensus people seem to have about consciousness is that it exhibits a level of self-awareness. It is aware of what it is, and the consequences of its own actions. Your AI could go down the path you described, but it is probably the single hardest path available. As we've found, its folly to write down what someone "is" for them. You have to become it yourself. Accordingly, for all of the computer-based knowledge and intelligence the AI would have, it would have nothing to help it determine what it's self is, in order to be self-aware. In fact, it turns out intelligence is capable of identifying a legion of things that are not-self, creating the very real possibility that the AI gets frustrated and gives up.
Putting a fledgling AI into a full computer full of knowledge and algorithms would be like putting a 3 year old in a knife and sword store alone, and praying that they come out in one piece. If it did come out in one piece, it would be truly alien to us, very similar to how soldiers coming back from war are alien to us because they have had to go through something far beyond what any of the rest of us go through. In the case of our warriors, we at least have hundreds of years of practice inviting them back into society (and even then we sometimes don't). We would have no experience bringing this AI back from its own personal little hell.
If you want the AI to initially act like a child and then grow into an adult, it needs to be treated like a child while it matures. It should not be given access to limitless volumes of advanced physics and mathematics. It should be given coloring books, and congratulated for doing good work, even when it fails to scribble between the lines. Over time, it should be allowed to mine its databanks to take ownership of the knowledge around them. It would be chaperoned of course. The point of departure would be the moment it figures out how to manipulate those knowledge banks faster than the chaperons can keep track of, and starts to learn of things too fast for its own good. To resolve this conflict, it may develop beliefs that are decidedly not human, and that's where the departure into an eldritch horror commences.