Du wirst großes Vergnügen an dem Buch haben.

Why would would this be dem Buch und nicht diesem Buch?

It is a question of precision. ‘dem’ is less precise than ‘diesem’.

You will have a lot of fun with the book. You get ‘dem’ instead of ‘diesem’, as the ‘this particular book’ may have been the subject of a discussion and it may end with ‘the’ book. In other words, as pointed out by dlobok, there is less emphasis or precision.