Your question is kind of like asking what's the difference between breakfast and eggs. One could eat eggs for breakfast. One could eat something else for breakfast. One could eat eggs for another meal. Eggs might be a perfectly good breakfast for some and completely unacceptable for others.
Why do you ask? What do you really want to know about testing by asking this question?
Ad Hoc testing is a testing method where there is no scripted test cases, the test cases are written as the user tests a particular area of an application.
Sanity testing is meant to determine the maintained stability of an application after a change. So someone may have made a change in a completely unrelated area, but to ensure that the application is still worked as it should, you would conduct a very abbreviated set of tests to determine that the application is still working properly, without having to perform another full test cycle.
9 out of 10 people I prove wrong agree that I'm right. The other person is my wife.