A história provavelmente é "First Contact" , uma famosa novela de " Murray Leinster " (pseudônimo de William Fitzgerald Jenkins), que também foi a resposta para esta velha pergunta . O enredo é exatamente como você descreveu, exceto que tem um final feliz: eles descobrem uma maneira de ir para casa sem destruir um ao outro e sem revelar os locais de seus planetas. (O rádio de 6 de outubro de 1955 de X Minus One adaptação é um pouco mais próxima da sua descrição.Uma outra adaptação de rádio, o 15 de janeiro de 1958 episódio de Explorando o amanhã , é mais fiel à história original escrita.) Aqui está a Wikipédia resumo do enredo:
Space travel is routine between planets in the Solar System. Ships function very much like naval warships or research vessels. There are technologies such as "overdrive" which allows a ship to travel much faster than light in normal space, and apparently artificial gravity within a ship. Atomic power is used everywhere, even in a space suit propulsion unit. Ships are equipped with "blasters", not necessarily for use as weapons, but for destroying space debris which would otherwise collide with the ship.
The exploration ship Llanvabon is approaching the Crab Nebula when it suddenly detects another ship on its radar. The two ships' radars are, in fact, interfering with each other, so each sees a wildly distorted image of the other ship. Even after the problem is resolved and the two crews, one human, one alien, establish communication, both realize they have a problem. Neither can leave without ensuring that the other cannot track them to their home planet.
The aliens are humanoid bipeds, but see in the infrared portion of the spectrum. Also, instead of using sound to communicate among themselves they use microwaves emitted from an organ in their heads. As one human points out, "From our point of view, they have telepathy. Of course from their point of view, so do we."
The crews discover they have much in common. This is especially true of young Tommy Dort and his counterpart on the other ship, to whom he has assigned the name Buck. Although they are only able to communicate through an artificial code, they are able to establish a rapport. However, Buck is pessimistic about the eventual outcome. He sends Tommy a message, "You are a good guy. Too bad we must kill each other."
The deadlock persists. Neither ship dares to leave for fear that the other will be able to track it home. Neither captain is ready to gamble by attacking the other ship. Then Tommy realizes the way out of the impasse. He and his Captain arrange an exchange of personnel between the ships. Tommy and the Captain go aboard the alien ship even as two aliens board the Llanvabon. Then they present an ultimatum: they will detonate the atomic power packs in their suits if the aliens refuse to go along with their plan, which is for each crew to take the other's ship back to their home planet. Each will disable all the tracking equipment on their own ship before the exchange, and indeed they will have to be thorough to prevent the new crew from tracking them.
At this point the aliens begin behaving very strangely, twitching or lying down and kicking the floor. In fact this is their equivalent of laughter. Their own people have just given the humans the same ultimatum, and the same plan.
The story ends with each crew taking over the other's ship. Naturally, before leaving their own ship they are able to remove everything which might point back to their home world. Each stands to benefit from the new technology on the other's ship. Each keeps the other race's fiction library to gain insight into their thinking. They agree to repeat the encounter at the same location some time in the future.
Tommy is confident that the two races will get along. He believes this because, as he tells the Captain, he and Buck spent a good deal of time swapping dirty jokes.