Using Pythagorean Theorem where the square of the hypotenuse is equal to the sum of the square of the legs
c² = a² + b²
having 3 as the length of 1 leg and 5 as the length of the hypotenuse you'll have
5² = 3² + b²
5² - 3² = b²
25 - 9 = b²
16 = b²
b = 4
therefore the length of the other leg is 4 units