The length of a dipole antenna is chosen so that the antenna is resonant at the frequency to be emitted. Since the wave speed in a good conductor is close to the speed of light in vacuum, the length should be close to the half the wavelength of the radiowaves in vacuum. See https://en.wikipedia.org/wiki/Dipole_antenna#Dipole_antennas_of_various_lengths
A different length can also be used if the resonance frequency is adjusted by use of a matching network.