When the basketball is thrown up an initial velocity is imparted to it. This gives the ball a kinetic energy equal to (1/2)*m*v^2 where m is the mass of the ball and v is the velocity with which it is thrown upwards. As the ball rises the kinetic energy of the ball decreases and this is converted to gravitational potential energy. If the height of the ball from the reference level it has been thrown from is h, the potential energy is m*g*h.
At the highest point of the ball's path all the kinetic energy has been converted to potential energy; as a result the velocity of the ball is 0 m/s and it comes to a stop.
The ball then begins to fall down, this decreases its height and consequently its gravitational potential energy. The decrease in potential energy of the ball leads to an increase in the kinetic energy. When the ball reaches the bottom, all the potential energy has been converted to kinetic energy and the speed of the ball is the same as that at which it was thrown upwards.