Why Lakers do it? They were clearly looking for a young PNR center to pair with Luka and ready to give up Knecht to make it happen. TJD isn't Mark Williams but he'd also be much cheaper to acquire and has time to develop on a team that better fits his playstyle. Also, Knecht probably doesn't feel great being on the team that was ready to send him out. Best to let him find a new home.
Why Warriors do it? TJD is out of the rotation. Post took his spot. Knecht brings more shooting, which we can always use more of. If we aren't going to use TJD at all, Knecht is another chance at finding a player to put into our rotation.