Hannes Olof Gosta Alfven was born in Norrkoping, Sweden, the son of Johannes Alfven (1878–1944) and Anna–Clara Romanus (1874–1947). Both his parents were practising physicians; they settled in the industrial town of Norrkoping because of their interest in social work. Hannes had one sister Anne–Marie (b. 1913), who became a librarian.
His father, who grew up in Stockholm, had a strong interest in science and especially psychiatry. One of his father's many brothers was also a physician, Andrew Alfven; he was politically radical and devoted much of his time to giving evening lectures at worker's institutes. Another uncle, Gosta Alfven, was an agronomist with concern for environmental issues; he also took a private interest in astronomy, keeping a daily journal of luminosity of the stars. A third uncle, Hugo Alfven (1872–1960) was a musician, famous both as a conductor and composer.