This is a great question! I’m going to attempt to teach you the entirety of Einstein’s theory of general relativity in less than 30 seconds.
Imagine you have a trampoline in your back garden/school or whatever. Now, stick a marble in the middle of it what do you think will happen? Well, it will bend the trampoline a little bit but not a huge amount. Now take the marble off and replace it with a large bowling ball, the trampoline fabric will bend a much larger amount! If you now roll the marble along the trampoline (near) the bowling ball it will “curve” inwards towards the bowling ball. This is exactly how Einstein viewed the universe. The sun bends this fabric called “Space-time” which allows all of the planets to move around the sun. Now, Black holes are very small but incredibly heavy. In fact, if you took the Earth and crushed it down into a golf ball (whilst keeping the same weight) then our earth would form a black hole. If you are to have a super stretchy trampoline (one that would never rip) and put the new and compressed earth into the centre it would stretch the fabric an insane amount! This is exactly what black holes do. They bend and curve spacetime an incredible amount which is why their gravity is stupendous (absolutely massive). So, to answer your question, a black hole bends a huge amount of spacetime (due to its weight) which “generates” a large amount of gravity.