The way we defined the truth-functional operators, $A \rightarrow B$ is indeed logically equvalent to $\neg A \lor B$. That is a plain mathematical fact. But the title of your question is much more interesting, and reflecting of where your true question is: Why is 'A only if B' translated as $A \rightarrow B$? Isn't that inconsistent with the possibility of A being false and B being true?
I think the confusion arises from our linguistic use of the phrase 'A only if B':
Sometimes when we use the phrase 'A only if B' we don't merely say that 'as long as B is not the case, A won't be the case either', but we also mean that 'once B does become the case, A will be the case as well'.
An example would be: 'you can take Calculus II only if you have taken Calculus I'. We typically use this to say that as long as you haven't taken Calculus I, you can't take Calculus II ... but once you have taken Calculus I, you can take Calculus II'.
So, in these examples, while we say 'A only if B', what we really mean is 'A if and only if B'. And if that is what we mean, then you are absolutely right: we can't have B true and A false at the same time. It wouldn't be the 'exact opposite' as you say, but it would be inconsistent with it, yes. So I can totally understand your confusion: you were probably thinking about the sentence exactly this way.
OK, so why then do we translate 'A only if B' not as a biconditional? Because many times we do not mean the biconditional. For example: 'someone is a bachelor only if they are male'. Now I say that if this person is not male, then they are not a bachelor, but obviously I do not mean to say that once someone is a male, they are automatically a bachelor. So in cases like that, you should only use a one-way conditional.
OK, so 'A only if B' is ambiguous? In English, yes, the use of it is! Sometimes we mean just the one-way conditinal, but other times we mean to express a biconditional, but since we are lazy we only express the one-way conditional, leaving the other direction to be filled in by the audience relying on common sense, background knowledge, and language conventions. Indeed, English is inherently more ambiguous than logic (actually: English is ambiguous and logic is not!).
This is why symbolization can be tricky: sometimes you have to read between the lines in The English sentence or passage to get the intended meaning. So, when presented with an 'A only if B', I would urge you to do exactly that: figure out what exactly is being intended here, and symbolize that.
Now, if you can't figure out whether a conditional or a biconditional was meant, then it is a really good idea to stick with the one-way conditional, because you can always be certain of that ... The other way may be intended, but if you don't know this for certain, then you should not assume that. That is, go with the weaker interpretation. That way, if you can get to your desired result (when trying to make an inference, for example), then you know the inference definitely holds, whether a conditional or biconditional was meant.
This is also the reason why 'A only if B' typically gets translated to just $A \rightarrow B$. And this is also why the book will insist that 'A only if B' becomes just $A \rightarrow B$. Without knowing what A and B are, that makes the most sense. Indeed, without knowing A and B, you should not have read more into the statement ... but you did, and that's why you got confused.
Finally, I would like to point out that this case is very similar to the confusion that sometimes surrounds the use of the word 'or', which can be used inclusively or exclusively. There too: if you know that the stronger exclusive or was meant, then go ahead an symbolize it as such (Indeed, to solvecertain logic problems, you have to). But if you don't know this, then you should take the 'safe' option and use the $\lor$ which is of course the weaker inclusive or.