An affine Lie algebra acts on cohomology groups of quiver varieties of affine type. A Heisenberg algebra acts on cohomology groups of Hilbert schemes of points on a minimal resolution of a Kleinian singularity. We show that in the case of type $A$ the former is obtained by Frenkel-Kac construction from the latter.