This is an issue of ownership chaining and how that doesn't automatically translate across databases as most people would expect. The following MSDN page has a good explanation of what is going on in this situation:
Ownership Chains
That article states that in order to get this to work as most would expect, you need to enable "Cross-Database Ownership Chaining". However, this is a security risk, and that article even has a section for "Potential Threats".
The more secure way to extend permissions is by using module signing. Please see my answer on the following Question (here on DBA.SE) for how to remedy this, especially if you don't want to give the user any access to Database B:
stored procedure can select and update tables in other databases - minimal permissions granted
The first time you go through this exercise it might seem terribly complicated, but after a few times it will make enough sense to not seem to bad ;-).
within the same database
. And that is due to Ownership Chaining. But databases are really isolated islands within the instance and need to directed to work with each other.