Why is "A only if B" equivalent to "(not A) or B"? I've encountered this recently and I just can't wrap my head around it. My book states that 
$$A \rightarrow B \equiv \neg A \lor B$$
It's my understanding that $A \rightarrow B$ means that if $A$ is true, then $B$ is true. 
But, $\neg A \lor B$ would allow for us to have that $\neg A$ is true and $B$ is true, which seems to be pretty much that exact opposite of $A \rightarrow B$, so how can these be equivalent?
 A: 
Why is “A only if B” equivalent to “(not A) or B”?

Let's make it less abstract:
A = You can have your pudding
B = You eat your meat
So "A only if B" means "You can have your pudding only if you eat your meat".
How can you avoid having pudding but not eating meat? Either by not having pudding or by eating your meat. Hence $\neg A \lor B$.

It's my understanding that $A \rightarrow B$ means that if $A$ is true, then $B$ is true. 

Correct. If we somehow find out that $A$ is true, we can be sure $B$ is true.

But, $\neg A \lor B$ would allow for us to have that $\neg A$ is true and $B$ is true, which seems to be pretty much that exact opposite of $A \rightarrow B$, so how can these be equivalent?

You're saying that you don't have any pudding even though you ate your meat somehow falsifies "if you don't eat your meat, you can't have any pudding". Nobody is saying that you must have pudding just because you ate meat.
If someone follows the rule "if you don't eat your meat, you can't have any pudding", then what we know is that if they had any pudding, they ate their meat. That is, "if you don't eat your meat, you can't have any pudding" is equivalent to "having any pudding implies you ate your meat".
This is perfectly consistent with you eating meat and not having pudding. This is perfectly consistent with you not eating meat and not having pudding. This is perfectly consistent with you eating meat and having pudding.
It is only violated if you have any pudding without eating any meat.
A: Here is a table showing all possible value-combinations for A and B in the first two columns. You can see that columns 3 and 5 are the same, therefore both predicates must be equivalent.  
| A | B | A->B | not A | (not A) or B |
|---|---|------|-------|--------------|
| T | T | T    | F     | T            |
| F | T | T    | T     | T            |
| T | F | F    | F     | F            |
| F | F | T    | T     | T            |

A: The only way to contradict "$A$ only if $B$" is to find $A$ being true when $B$ is false. 
But that is also the only way to contradict  "(not $A$) or $B$"
Meanwhile $A$ being false and $B$ being true is consistent with both expressions. It would contradict "$A$ if $B$" but that loses the only
A: 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.
A: "A only if B" means that you can't have A without B, i.e. $\neg(A\wedge(\neg B))$, which simplifies (via de Morgan) to $(\neg A)\vee B$.
A: Philosophical meaning of implication is "from false you can get anything, but from truth you can get only truth". So now if we write down the truth table of implication and $\neg A \lor B$. We can see, that they are similar.
A: What you have encountered is a variation on vacuous truth. If the premise is false, then the statement is true. For instance, I can say "If I'm from Mars, then it will rain candy tomorrow", and that will be a true statement. It is true because it is not a lie. It could only be a lie if I really were from Mars, and at the same time it didn't rain candy tomorrow, and it is pretty safe to assume that this is not the case.
Similarily, we can have mathematical statements formulated in the same way. For a famous example, take

If there exists non-zero integers $a, b, c$ and a natural number $n>2$ such that $a^n+b^n = c^n$, then there exists a non-modular elliptic curve.

This statement was proven true a decade before Fermat's last theorem was proven (i.e. there are no such numbers $a, b, c, n$). In fact, the truth of the statement above was explicitly used to prove Fermat's last theorem, by showing that the conclusion was false (in other words, we have $\lnot B$), which forced the premise to be false (i.e. we must have $\lnot A$). This is exactly what $\lnot A\lor B$ means as well.
The fact that the above statement was used to prove Fermat's last theorem makes this a slightly circular example. However, we have since (probably) proven the $abc$-conjecture, which also implies Fermat's last theorem, so it's still viable.
