So, an has two meanings that (I believe) you've learned. Yes, it can act as the definite article. However, it's also the question particle in some tenses. The difference is whether it comes before a noun or a verb. So here, an is marking a question. Bhfuil the form of bí that goes after the question particle in the non-habitual present tense.
Also, a more literal translation is "Is there a book at you" (note, ag means "at", not "with").
Thanks for adding the example with the plural form. I'm finding the difference quite subtle. She is rolling the r in the singular but there is a slight trill (I think is the way to explain it) in the plural. This makes it quite similar to my ear. I will need to pay close attention to this to get it right.
Listen to these examples of leabhar:
Osclaím an leabhar - https://forum.duolingo.com/comment/13287730
Is liomsa an leabhar - https://forum.duolingo.com/comment/4352350
The end in a straightforward "r" sound, as you would make in English.
Now listen to these examples of leabhair:
Bailímid na leabhair - https://forum.duolingo.com/comment/4329560
Léann siad leabhair - https://forum.duolingo.com/comment/4314918
Osclaímid na leabhair - https://forum.duolingo.com/comment/7367046
The slender r at the end of these examples is clearly not the same "r" sound that you hear in the earlier examples. It's not a sound that is used in English, so you don't have an easy label for it, and your ear isn't used to taking notice of it, and assigning significance to it, but it is definitely not the same sound as an English "r".
Standard English doesn't differentiate between "singular "you" (talking to one person) and plural "you" (talking to multiple people). In many dialects of spoken English, though, there is a distinction made, such as "you all" for plural "you" in Southern US English, or "ye" in some parts of Ireland and Britain.
This distinction doesn't always make it into written English (even people who make the distinction in spoken English might not make it when writing), but it is useful when translating from Irish, where there is a distinction between tú (singular "you") and sibh (plural "you"). In this exercise agaibh tells us that the question is addressed to a group, so "do ye have" is accepted as an answer.
I am getting a little confused about the usage of "an bhfuil". Here it translates to "Do you have a book?" Another sentence "An bhfuil torthaí ón gcailín?" translates to "Does the girl want fruits?" Is it interchangeable between "want" and "have"? Or does some part of the context determine the meaning?
Irish doesn't have a verb that means "have", or a verb that means "want". Instead the phrasal verb tá ... ag is used to say "have" and tá ... ó is used to say "want".
Tá X ag Y - "Y has X"
Tá X ó Y - "Y wants X"
An bhfuil is the interrogative form of Tá, so An bhfuil X ag Y? means "Does Y have X?" and An bhfuil X ó Y? means "Does Y want X?".
The preposition used modifies the meaning of the verb.
No, bhfuil is also used after the conjunction go:
Deir sé go bhfuil ocras air - "he says he is hungry"
Ceapaim go bhfuil an ceart agat - "I think you're right"
Tá áthas orm go bhfuil tú anseo - "I am glad you are here"
and with the relative particle a:
duine a bhfuil ocras air - "a person who is hungry"
fanacht mar a bhfuil tú - "stay put"
leaba nach bhfuil cóirithe - "an unmade bed"