The most concise way to answer this very complex question is to say that Kant essentially argued that causality was a priori, that it was a necessary relationship. A priori knowledge was knowledge that we know to be correct before experience, like a mathematical theory. The sun, he used by way of an example, by its very nature heated a stone which was left outside in the sunlight:
If I say that experience teaches me something, I always mean only the perception that lies within in it, e.g., that heat always follows the illumination of the stone by the sun. That this heating results necessarily from the illumination by the sun is in fact contained in the judgement of experience (in virtue of the concept of cause); but I do not learn this from experience, rather, conversely, experience is first generated through this addition of the concept of the understanding (of cause) to the perception.
Hume had claimed, on the other hand, that effect is never knowable a priori, and had to be confirmed by experience. We had to see the stone heated by the sun over and over again. Kant's argument was that the concept of the connection was in our minds, brought to the act of observation.