In the Word there can be two meanings, depending upon the context. By “Egypt” can be meant either good or bad. Sometimes, Egypt is spoken of in a good sense, denoting those who are in memory-knowledges [scientifica], that is, in natural truths, which are the vessels of spiritual truths. 
“Therefore it shall come to pass, when the Egyptians shall see thee, that they shall say, This is his wife: and they will kill me, but they will save thee alive.” (Genesis 12: 12)
“And it shall come to pass, when the Egyptians shall see thee,” signifies the memory-knowledge of knowledges [scientia cognitionum], which is described as to what it is when they see celestial knowledges; “that they will say, This is his wife,” signifies that they will call the knowledges celestial; “and they will kill me, and will make thee to live,” signifies that they would not care for the celestial things, but only for the mere knowledges, which they would carry off. 
The Egyptians began to make their delight consist in memory-knowledge alone. In proportion as they made their delight consist in mere memory-knowledge, in the same proportion they removed themselves from what is celestial, and became material. In proportion as the memory-knowledges are learned with the end of use, – as for the sake of human society – the more are they opened toward the Almighty. 
The “memory-knowledge” may be what Dame Frances Yates called “the art of memory.” In the late 16th century, Giordano Bruno published two books on the art of memory “which reveal him as a magician.” The art of memory was “a method of printing basic or archetypal images on the memory, with the cosmic order itself as the ‘place’ system, a kind of inner way of knowing the universe.” This was part of the Hermetic system for reflecting the universe in the mind. It was, Yates believed, “at the root of Renaissance magic memory,” a method of “imprinting archetypal, or magically activated, images on the memory. By using magical or talismanic images as memory-images, the Magus hoped to acquire universal knowledge, and also powers…” 
The magic of the Egyptians had its origin in the memory-knowledge. They were acquainted with the correspondences of the natural world with the spiritual, and afterward, when the church among them was at an end, these correspondences were abused by being turned to magical things. 
The memory-knowledges were cultivated among the Egyptians more than among others, and were turned by them into magic; whereby they completely inverted the memory-knowledges of the representative church. 
They who become such as the declining Egyptians know how to reason acutely and skillfully from memory-knowledges, because they reason from the senses, and to reason from these is to reason from such things as are external, that is, from such as are of the body and the world, which take direct hold of man’s senses and feelings. Unless such things have been illumined by the light of heaven, and thereby arranged in an entirely different order, they put the man in so great an obscurity as to heavenly things that he not only comprehends none of them, but even wholly denies, and at last rejects them, and then as far as he may, blasphemes them. 
Thus the Egyptians abominated everything that belonged to the Ancient (postdiluvian) Church. The reason was that at first the Egyptians had been among those who constituted the Ancient representative Church; but in course of time they rejected the God of the Ancient Church, that is, Jehovah or the Lord, and served idols, especially calves; and they also turned into magic the very representatives and significatives of the celestial and spiritual things of the Ancient Church, which they had learned when they belonged to that church. Hence order was inverted with them, and consequently all things of the church were an abomination to them. 
That by the “Egyptians” are signified memory-knowledges opposed to the truths of the church, is because the representatives and significatives of the Ancient Church, which church had also been with them, were there turned into things magical; for by the representatives and significatives of the church of that time there was communication with heaven. This communication was with those who lived in the good of charity, and was open with many; whereas with those who did not live in the good of charity, but in its opposites, open communication was sometimes granted with evil spirits, who had perverted all the truths of the church, and together with these had destroyed its goods, whence came things magical. This can also be seen from the hieroglyphics of the Egyptians, which also were made use of in sacred things, for by them they signified spiritual things, and perverted Divine order. 
Lest therefore the representatives and significatives of the church should be further turned into magic, the Israelitish people was taken, with whom the representatives and significatives of the church might be restored; which people was of such a nature that it could not make anything magical therefrom, because it was altogether in externals, and had no belief in anything internal, still less in anything spiritual. With people of such a character, such magic as existed with the Egyptians cannot arise. 
——- Sources ——-
 Arcana Coelestia, by Emanuel Swedenborg. Number 1462.
 Arcana Coelestia, by Emanuel Swedenborg. Number 1471.
 Arcana Coelestia, by Emanuel Swedenborg. Number 1472.
 Giordano Bruno and the Hermetic Tradition, by Frances A. Yates. University of Chicago Press, 1991.
 Arcana Coelestia, by Emanuel Swedenborg. Number 4964.2.
 Arcana Coelestia, by Emanuel Swedenborg. Number 5700.
 Arcana Coelestia, by Emanuel Swedenborg. Number 5700.2.
 Arcana Coelestia, by Emanuel Swedenborg. Number 5702.
 Arcana Coelestia, by Emanuel Swedenborg. Number 6692.
 Arcana Coelestia, by Emanuel Swedenborg. Number 6692.3.