Cats sometimes crawl on people's legs or bodies, possibly because they are seeking attention or warmth. Cats are social animals and they like to be around people and other animals. When they crawl on your legs, it may be one of their ways of getting close to you. Cats may also crawl on your lap because they want to observe their surroundings. In addition, cats may also crawl on your legs because they feel that your legs are a safe place.
Cats sometimes feel anxious or fearful and will look for a safe place to hide. If they feel your legs are a safe place, they will climb up there. In short, the reasons why a cat crawls on your lap may be varied, including seeking attention and warmth, observing the surrounding environment, looking for a safe place, etc. If you don't like cats crawling on your lap, you can try providing them with some other form of attention or warmth, such as providing them with a comfortable place to sleep or being petted.