In the US, funds are not taxed on their realized gains, instead the shareholders are taxed. Funds realize gains when they need to sell holdings at gain (after deducting losses) for whatever reason (rebalancing, excessive withdrawal rate, change of investment policy, etc).
Your portion of the gains will be reported on the 1099-DIV you'll get from your broker or the fund, if you're a direct investor. Note that even though you might not get an actual distribution, it will be reported as if gains have been distributed to you. In that case (you didn't get a distribution, but the fund reported capital gains) your basis will be reduced accordingly. Some brokers do the math for you, but if you're holding the fund for a while (since before 2013) - most won't. You'll have to keep that in mind when you sell and adjust cost basis accordingly.
So the bottom line is that the capital gains reported to you on 1099-DIV will go to the 1040 of the year for which they've been reported, as either long or short capital gains (or both...) as reported, and you'll pay tax on them. When you sell the holding, you'll pay the tax on the gain you have realized (and not the fund).
As for the retirement accounts (IRA, 401k, etc) - they're better vehicles for these kinds of funds because capital gains are not taxed. Neither are dividends or any other earnings and distributions from holdings into the account. So the capital gains passed to you get cancelled out by the preferential treatment of the account. You will not receive 1099-DIV or 1099-B for these accounts, only 1099-R for distributions, which may be taxed as ordinary income or not taxed at all (qualified Roth distributions).
So while you'd think twice whether to get into an actively managed fund in a regular brokerage account, this (quite significant, occasionally) disadvantage disappears when you're investing in a tax-sheltered account.