Let a length "x" of the chain be hanging at a particular instant. Then the loss in potential energy of the chain is
U = l x g x / 2
Which is then converted into Kinetic energy of that part. Therefore
U = gain in Kinetic energy of the hanging part.
l x V2 / 2 = l x g x / 2
V = Ö g x.