You don't say if this is all the time, or occasional. Or, which expansions you have.
There is a problem, that I am aware of with China, where bad pathing traps NPCs.
If you type resetsim * when you get the control of the game back after a lag spell, all characters including your own will be returned to home. If the lagging stops temporarily after doing this then your problem may have been a stuck sim, or indeed sim animal. I have also had horses get stuck in the fencing around the science facility in Sunset Valley. NPCs can occassionally get stuck in almost any town, so resetsim * is always worth a try when the computer lags badly.
I'm afraid, if the problem is not stuck NPCs, I can't help you, but, I'm sure others here may have the answer.