Why did a knight spend years practicing his fighting skills? To defend the lord and lady he served.
He also had to defend the castle where he lived. Sometimes this meant charging onto a battlefield. Just as often, a knight had to keep enemies from breaking down the walls and forcing their way into the castle.
Enemies always first tried to take a castle by force. If this failed, they had a second plan, called a siege. During a siege, the attackers formed a circle around the castle. No one could come in or leave. Then the attackers waited. They hoped the people inside would run out of food and other supplies and give up.