While en route, the Enterprise had stopped to view the Beta Niobe supernova where it encountered an alien ship heading directly into the nova at a speed of warp 36. Fearing for the life of the sole occupant of the alien ship, Kirk ordered his crew to engage the tractor beam so as to slow or even stop the vessel's course. The tactic failed and the alien ship ended up dragging the Enterprise into the nova and then into the antimatter universe where black stars shone in a white void.
In the antimatter universe, Kirk's crew quickly came to realize that the normal processes of their ship, as well as their bodies, worked in reverse. For example, the Enterprise's controls all worked in reverse, the ship traveled backwards through space, and the ship's chronometers all ran in reverse. Spock also commented that the crew themselves were growing younger in age. He would later theorize that the inhabitants of this antimatter universe were born in old age and would die in their infancy; essentially their descendants were born before them, and their ancestors were born after them. The brains of the crew also worked in reverse allowing them to understand language in the antimatter universe without the use of the universal translator.
Upon arriving in the antimatter universe, the pilot of the alien vessel, Karla Five, was contacted by the Enterprise and she offered the assistance of her world's scientists in getting Kirk and his crew back to their own universe. Karla Five escorted the Enterprise to Arret, her homeworld, and whose location in the antimatter universe corresponded with Earth in the normal universe.
Earlier, Karla Five had revealed her theory that stars dying in the normal universe, and stars being born in the antimatter universe acted as gateways between the two so long as they occupied the same space in both universes. It was the dying Beta Niobe and the antimatter universe's newly born star, Amphion, which had created the initial gateway for the Enterprise to enter the antimatter universe. With this information, the crew of the Enterprise then sought out two stars occupying the same space in both universes as a means to get home. (TAS episode: "The Counter-Clock Incident")