Jesus knew these things because He believed the scriptures about Him.
When He was baptized of John in water He was also baptized with His HolySpirit who confirmed His faith in the Word.
Jesus wants you to know who you are in the NewBirth and to allow His HolySpirit to work through you as He does in Him.
Jesus knew that He had stepped down from heaven where He was the eternal Word of the HolySpirit and manifested Himself in flesh and blood for the purpose of being the sacrificial Lamb for the sins of the world.
He also knew that He would return to heaven and resume His role as the eternal Word of the HolySpirit, but with a physical body.
His HolySpiritFather had put all things in His hands to accomplish the conditions of Grace so that He, the Father, could dwell in us and we in Him. Mat 28:18
This mutual indwelling is the gift of EternalLife. Joh 17:3