Why did the child Jesus remain in Jerusalem? Because of His love of prayer and communion with His Heavenly Father, and to show, even then, some rays of His divinity, by which to make known that He had come for the glory of His Father, and to procure our salvation. The glory of God and the salvation of our souls should be our chief object in life.... from "The Church's Year" by Fr. Goffine.
For an even meatier discussion read what Fr. Lapide had to say.
And He said unto them, How is it that ye sought me? wist ye not that I must be about my Father’s business? S. Ambrose holds that these are the words of one administering reproof. And Christ, as the Messiah, and as a Lawgiver, might rightfully have reproved His mother had she sinned. But there was no blemish of sin in His mother, neither therefore was there any reproof on the part of Christ. Still, there is in the words a certain sharpness of tone, savouring of reproof, that He may teach them by His question and incite them the more keenly to learn the things that concerned Him, just as parents are wont to stimulate their children to zeal and diligence with sharp words, and masters their pupils. These words of Christ, then, are the words of one instructing and consoling; excusing himself, and defending what he has done:— From Fr. Lapide's Commentary