It can attract dirt and debris: WD-40 is a penetrating oil, which means that it can seep into small crevices and may attract dirt and debris. Over time, this can actually make your lock more difficult to operate.
It can cause the lock to become slippery: While lubrication is important to prevent a lock from freezing, too much lubrication can cause the lock to become slippery and difficult to turn. This can make it harder to open the lock, especially if you are using a key that is not perfectly smooth.
It can damage some types of locks: WD-40 is not suitable for use on all types of locks. It can damage some types of locks, such as those with brass or copper components, or those that are coated with a special finish.