The y-calculation is the formula for an upside-down parabola which crosses the x-axis at 0 and target_dist, and reaches max_height in the middle (which it is symmetric around). Since the standard X^2 function is symmetric around x = 0, we subtract target_dist/2 from the x-value so it'll be symmetric around that point instead (essentially shifting the curve to the right). Apart from the first term, the rest of the equation is with a negative sign so that the parabola is upside-down.
*max_height/(target_dist/2)/(target_dist/2) is a way to scale the parabola along the y-axis, because we want the difference in height between the lowest points (x=0 and x=target_dist) and the highest point (x = target_dist/2) to be max_height, not (target_dist/2)^2. And having (+) max_height at the beginning shifts the curve up so that the top point is at that y-value. Like I said, this isn't the simplest form of this equation, I just wrote it down according to the logic just described.
The ball should move at the same speed along the x-axis (you increment ball.x by one each loop, moving the ball one pixel to the right), but along the y-axis it moves slower when it's higher. Why? Because of course it starts moving up quickly, then more and more slowly until reaches the highest point, and then it turns around and starts falling faster and faster. That's realistic. However, by doing this all with ints, there's likely to be some serious rounding errors, so the y-movement could be off in ways that makes it move even slower. Really the best way is to convert everything to floats, do the calculation, and then round the result to the nearest int.
To make it move faster, instead of doing ball_x++ at the end of the loop, you can increment ball_x by 2 or more. But then you should set the coordinates to the target after the loop finishes, since it might skip the last step otherwise. Again, you can use floats to set fraction-of-a-pixel movements, but you'll need to keep track of error terms and stuff like that, and at that point you might as well go with Khris's vector idea.