If we're generous in our opinion of him, it's doubtful Khosla wanted to prevent the public from using the beach. What he probably wanted was to prevent the press getting exceptionally close to him and his family, from having founders 'accidentally' meeting him when he was at home, and so on.
There is a thing called the 'principle of double effect' (thought up by Thomas Aquinas back in the 13th century; it's not a new thing) that's incredibly important to understanding the world around us - nothing we do has a single, isolated effect. Ever. There are always several causes for things, and many effects. Picking one and assuming that was the reason, or even just the most important reason, is wrong. In this case it's reasonable to think Khosla closed access to the beach for several reasons, and that had several effects, one of which was preventing public access which is why it ended up in court.