Once, Gargamuni, the priest of the Yadu dynasty, was taunted by his brother-in-law. When the kings of the Yadu dynasty heard the taunt they laughed at him, and Gargamuni became angry at the Yadu kings. He decided that he would produce someone who would be very fearful to the Yadu dynasty, so he pleased Lord Śiva and received from him the benediction of a son. He begot this son, Kālayavana, in the wife of a Yavana king. This Kālayavana inquired from Nārada, “Who are the most powerful kings in the world?” Nārada informed him that the Yadus were the most powerful. Being thus informed by Nārada, Kālayavana attacked the city of Mathurā at the same time that Jarāsandha attempted to attack it for the eighteenth time. Kālayavana was very anxious to declare war on a king of the world who would be a suitable combatant for him, but he had not found any. However, being informed about Mathurā by Nārada, he thought it wise to attack this city. When he attacked Mathurā he brought with him thirty million Yavana soldiers. When Mathurā was thus besieged, Lord Śrī Kṛṣṇa began to consider how much the Yadu dynasty was in distress, being threatened by the attacks of two formidable enemies, Jarāsandha and Kālayavana. Time was growing very short. Kālayavana was already besieging Mathurā from all sides, and it was expected that the next day Jarāsandha would also come, equipped with the same number of divisions of soldiers as in his previous seventeen attempts. Kṛṣṇa was certain that Jarāsandha would take advantage of the opportunity to capture Mathurā when it was also being besieged by Kālayavana. He therefore thought it wise to take precautionary measures to defend the strategic points of Mathurā. If both Kṛṣṇa and Balarāma were engaged in fighting with Kālayavana at one place, Jarāsandha might come at another place to attack the whole Yadu family and take his revenge. Jarāsandha was very powerful, and having been defeated seventeen times, he might vengefully kill the members of the Yadu family or arrest them and take them to his kingdom. Kṛṣṇa therefore decided to construct a formidable fort in a place where no two-legged animal, either man or demon, could enter. He decided to keep His relatives there so that He would then be free to fight with the enemy. It appears that formerly Dvārakā was also part of the kingdom of Mathurā, because in the Śrīmad-Bhāgavatam it is stated that Kṛṣṇa constructed a fort in the midst of the sea. Remnants of the fort, which Kṛṣṇa constructed, are still existing on the Bay of Dvārakā. He first of all constructed a very strong wall covering ninety-six square miles, and the wall itself was within the sea. It was certainly wonderful and was planned and constructed by Viśvakarmā. No ordinary architect could construct such a fort within the sea, but an architect like Viśvakarmā, who is considered to be the engineer among the demigods, can execute such wonderful craftsmanship anywhere in any part of the universe. If huge planets can be floated in weightlessness in the outer space by the arrangement of the Supreme Personality of Godhead, surely the architectural construction of a fort within the sea covering a space of ninety-six square miles was not a very wonderful act. It is stated in the Śrīmad-Bhāgavatam that this new, well-constructed city, developed within the sea, had regular planned roads, streets and lanes. Not only were there well-planned roads, streets and lanes, but there were well-planned paths and gardens filled with plants known as kalpavṛkṣas, or desire trees. These desire trees are not like the ordinary trees of the material world; the desire trees are found in the spiritual world. By Kṛṣṇa’s supreme will, everything is possible, so such desire trees were planted in the city of Dvārakā constructed by Kṛṣṇa. The city was also filled with many palaces and gopuras, or big gates. These gopuras are still found in some of the larger temples. They are very high and constructed with extreme artistic skill. Such palaces and gates held golden waterpots (kalaśa). These waterpots on the gates or in the palaces are considered to be auspicious signs. Almost all the palaces were skyscrapers. In each and every house there were big pots of gold and silver and grains stocked in underground rooms. And there were many golden waterpots within the rooms. The bedrooms were all bedecked with jewels, and the floors were mosaic pavements of marakata jewels. The Viṣṇu Deity, worshiped by the descendants of Yadu, was installed in each house in the city. The residential quarters were so arranged that the different castes, brāhmaṇas, kṣatriyas, vaiśyas and śūdras, had their respective quarters. It appears from this that the caste system was existing even at that time. In the center of the city there was another residential quarter made specifically for King Ugrasena. This place was the most dazzling of all the houses. When the demigods saw that Kṛṣṇa was constructing a particular city of His own choice, they sent the celebrated pārijāta flower of the heavenly planet to be planted in the new city, and they also sent a parliamentary house, Sudharmā. The specific quality of this assembly house was that anyone participating in a meeting within it would overcome the influence of invalidity due to old age. The demigod Varuṇa also presented a horse, which was all white except for black ears and which could run at the speed of the mind. Kuvera, the treasurer of the demigods, presented the art of attaining the eight perfectional stages of material opulences. In this way, all the demigods began to present their respective gifts according to their different capacities. There are thirty-three million demigods, and each of them is entrusted with a particular department of universal management. All the demigods took the opportunity of the Supreme Personality of Godhead’s constructing a city of His own choice to present their respective gifts, making the city of Mathurā unique within the universe. This proves that there are undoubtedly innumerable demigods, but none of them are independent of Kṛṣṇa. As stated in the Caitanya Caritāmṛta, Kṛṣṇa is the supreme master, and all others are servants. So all the servants took the opportunity of rendering service to Kṛṣṇa when He was personally present within this universe. When the new city was fully constructed according to plan, Kṛṣṇa transferred all the inhabitants of Mathurā and entrusted Śrī Balarāma as the city father. After this He consulted with Balarāma, and being garlanded with lotus flowers, He came out of the city to meet Kālayavana, who had already seized Mathurā without taking up any weapons. When Kṛṣṇa came out of the city, Kālayavana, who had never seen Kṛṣṇa before, saw Him to be extraordinarily beautiful, dressed in yellow garments. Passing through his assembly of soldiers, Kṛṣṇa appeared like the moon in the sky passing through the assembled clouds. Kālayavana was fortunate enough to see the lines of Śrīvatsa, a particular impression on the chest of Śrī Kṛṣṇa, and the Kaustubha jewel which He was wearing. Kālayavana saw Him, however, in His Viṣṇu form, with a well-built body, with four hands, and eyes like newly blooming lotus petals. Kṛṣṇa appeared blissful, with a handsome forehead and beautiful face, with smiling restless eyes and moving earrings. Before seeing Kṛṣṇa, Kālayavana had heard about Him from Nārada, and now the descriptions of Nārada were confirmed. He noticed Kṛṣṇa’s specific marks and the jewels on His chest, His beautiful garland of lotus flowers, His lotus-like eyes and similar beautiful bodily features. He concluded that this beautiful personality must be Vāsudeva, because every description of Nārada’s which he had heard previously was substantiated by the presence of Kṛṣṇa. Kālayavana was very much astonished to see that He was passing through without any weapon in His hands and without any chariot. He was simply walking on foot. Kālayavana had come to fight with Kṛṣṇa, and yet he had sufficient principles not to take up any kind of weapon. He decided to fight with Him hand to hand. Thus he prepared to capture Kṛṣṇa and fight. Kṛṣṇa, however, went ahead without looking at Kālayavana, and Kālayavana began to follow Him with a desire to capture Him. But in spite of all his swift running, he could not capture Kṛṣṇa. Kṛṣṇa cannot be captured even by the mental speed attained by great yogīs. He can be captured only by devotional service, and Kālayavana was not practiced in devotional service. He wanted to capture Kṛṣṇa, and as he could not do so he was following Him from behind. Kālayavana began running very fast, and he was thinking, “Now I am nearer; I will capture Him,” but he could not. Kṛṣṇa led him far away, and He entered the cave of a hill. Kālayavana thought that Kṛṣṇa was trying to avoid fighting with him and was therefore taking shelter of the cave. He began to chastise Him with the following words: “Oh You, Kṛṣṇa! I heard that You are a great hero born in the dynasty of Yadu, but I see that You are verily running away from fighting, like a coward. It is not worthy of Your good name and family tradition.” Kālayavana was following, running very fast, but still he could not catch Kṛṣṇa because he was not freed from all contaminations of sinful life. Kālayavana belonged to the class of mleccha and yavanas. He was contaminated by sinful activities and could not approach Kṛṣṇa. The principles from which higher class men are restricted, namely illicit sex indulgence, meat eating, gambling and intoxication, are part and parcel of the lives of the mlecchas and yavanas. Being bound by such sinful activities one cannot make any advancement in God realization. The Bhagavad-gītā confirms that only one who is completely freed from all sinful reactions can be engaged in devotional service or Kṛṣṇa consciousness. When Kṛṣṇa entered the cave of the hill, Kālayavana followed, chastising Him with various harsh words. Kṛṣṇa suddenly disappeared from the demon’s sight, but Kālayavana followed and also entered the cave. The first thing he saw was a man lying down asleep within the cave. Kālayavana was very anxious to fight with Kṛṣṇa, and when he could not see Kṛṣṇa, but saw instead only a man lying down, he thought that Kṛṣṇa was sleeping within this cave. Kālayavana was very puffed up and proud of his strength, and he thought Kṛṣṇa was avoiding the fight. Therefore, he very strongly kicked the sleeping man, thinking him to be Kṛṣṇa. The sleeping man had been lying down for a very long time. When he was awakened by the kicking of Kālayavana, he immediately opened his eyes and began to look around in all directions. At last he began to see Kālayavana, who was standing nearby. This man was untimely awakened and therefore very angry, and when he looked upon Kālayavana in his angry mood, rays of fire emanated from his eyes, and Kālayavana burned into ashes within a moment. Ref >> Srila Prabhupada Vani.
Transfer from Mathura to Dwaraka.