Edited in the light of comments and follow-on questions
Your mutual fund manager buys and sells securities in pursuit of
the investment strategies
of the fund as well as to invest new money coming in and to pay out investors wanting to take their money elsewhere. This results in capital gains and losses for the fund.
The net capital gain is taxable income (at corporate rates)
to the fund unless the fund distributes the gains to the shareholders
in which case the investors have to pay the taxes on the gains
that they receive. For what happens if the fund experiences a
net capital loss,
see this answer to a related question.
You have to report the capital gains distributions from a mutual
fund regardless of whether you chose to re-invest in the fund or
received the distribution in cash, or had directed your broker
(or the fund company) to reinvest the distribution into another
fund etc. You do not report or pay taxes on any changes in
the value of your mutual fund investment as share prices of the
securities of the fund fluctuate; only when you sell
any shares do you have a capital gain or capital loss on that
portion of your investment.
With regard to your question about "taking from your shares", the value of
your mutual fund shares is determined by the net value of the underlying
securities held by the mutual fund plus any cash held by the mutual fund.
When the mutual fund makes a capital gain (or dividend) distribution to
its shareholders, the mutual fund assets decline in value by the amount
of the distribution because that money is out the door. Consequently
the share value falls proportionally. For those who choose to re-invest
in the fund, they get to buy the fund at the reduced value. Put another
way, suppose you bought 100 shares at $8 per share on January 1, 2010.
Your basis (the amount invested) is thus $800.
In 2010, the net capital gains of the fund were 0 and no distribution
was made. In late 2011, the mutual fund shares were valued at $10
and so you have a unrealized gain of $200, not reportable, not
taxable etc. But suppose that during 2011, the fund sold some securities
for a capital gain, and so in late 2011, it made a distribution of
$1 per share and "sent you" $100. After this distribution,
each of your shares would have value only $9, and your net wealth
would be $900 in shares plus $100 in cash. If you have chosen to
reinvest the $100 in new shares, you would be buying 100/9 shares
at $9 dollars each so that you now own (100+100/9) shares valued
at $9 each, making your net wealth $(100 + 100/9)x9 = $1000 just
as before. No change in value, but you have to report the $100
received on your tax return and pay taxes on the
$100 received, even though you reinvested the whole amount.
But now your basis in the fund is $900; the amount
$800 you originally invested plus the $100 you plowed back
into the fund. If at a later time, you decide to get out of
the mutual fund, and the share price is still $9 that day,
you will get $1000 for your 100+100/9 = 111.1111111 shares.
Only $100 of that amount is taxable since your basis is
$900. The point of JoeTaxpayer's comment below is that far
too many people forget to add the reinvested amounts into
the basis and say "I put in $800, got $1000 back, and so
I owe taxes on $200 profit" quite forgetting that they have
actually invested $900, or equivalently, that they have already
paid taxes on $100 of the $200, and so taxes are owed
only on the remaining $100. Now, it is true (as the comment by @dave_thompso _085 points out in a comment) that starting in 2012, mutual funds were required to track your basis (including reinvested distributions) but at least two major mutual fund houses have taken the position that this applies only to the shares bought from 2012 onwards. They won't go back though their records to determine the basis for the shares held directly by the investor (i.e. not through a brokerage) prior to 2012. They do provide paper forms that the investor can fill out telling them the basis of shares held prior to 2012. (Whether they check if the information provided matches with their records is something I don't know.) Alternatively, when the shares are sold, one can report the basis not included on the 1099-DIV in Part II of Schedule D directly to the IRS; just be sure to follow the same rules (FIFO, LIFO, or Average Cost) as you told the mutual fund that you wanted them to follow in determining the basis of the shares sold.
(note from JoeTaxpayer added) - If reinvested, you must add the $100 to your basis, the same as if 'new' money came in. This point is often missed and tax paid twice in error.
There have been several years in the recent past where mutual
funds declined in value over the course of a year (unrealized
capital loss for the share holder) but still paid capital gains
distributions which had to be reported and on which tax had to