Let $R$ be a regular algebra over a field $k$ of char 0. Let $D$ be its corresponding algebra of differential operators. 


As in the general setting of non-commutative algebra we can tensor right $D$-modules with left $D$-modules to get $R$-modules. However in this case we have more operations available to us. 


Let $M$ and $N$ be left $D$-modules. One can define using the leibniz rule a structure of a $D$-module on the tensor product $M \otimes\_R N$. The same can be done if we replace one of the factors with a right $D$-modules and flip some signs and similar statements exist for internal Homs over $R$ (i'm not so sure about right tensor right - although I assume that at least in the derived setting one can always use duality to define this structure). 


Now, my question is rather vague. I'm trying to understand conceptually what properties of $D$ makes it possible to give a $D$-module structure on $M \otimes\_R N$ and maybe understand in what way is this construction canonical (since so far all i've seen is a formula in this context). So to summarize:



> 
> Why do $M \otimes\_R N$ and $\mathrm{Hom}\_R(M,N)$ have a natural structure of $D$-modules? 
> 
> 
> 


Edit: After being confused by some conflicting answers I've posted a more detailed and exaustive question here: [What kind of algebraic object is $\mathcal{D}\_X$? (algebra of diifferential operators). What's special about modules over it?](https://mathoverflow.net/questions/257773/what-kind-of-algebraic-object-is-mathcald-x-algebra-of-diifferential-oper) 


EDIT: Some time has passed and i'm still not satisfied with the my current understanding of this. The original question still remains a mystery: **What kind of algebraic object is $\mathcal{D}$?** A suitable answer would give a definition of an algebraic object $D$ over a ring $R$ for which all the following holds



> 
> **1.** The opposite $D^{op}$ is canonically morita equivalent to $D$ (Canonically in the sense that the equivalence should be induced from the algebraic structure on $D$). 
> 
> 
> **2.** The ability to form tensor products and hom modules over $R$ between left and right $D$-modules except in two cases: 
> 
> 
> * Tensor product of a right $D$-module with a right $D$-module.
> * Hom module (over $R$) from a right $D$-module to a left $D$-module
> 
> 
> **3.** The forgetful from $D$-modules to $R$-modules is monoidal w.r.t. above tensor product.
> 
> 
> 



Why should the tensor product of $\mathcal{D}_X$-modules over $\mathcal{O}_X$ be a $\mathcal{D}_X$-module?
OK, I'll give it a shot. The bi-algebra structure on $D$ is something that I found very confusing too, so I will try to spell it out as best I understand. These ideas were explained to me by Pavel Safronov, and I found these notes by Gabriella Bohm be helpful <https://arxiv.org/abs/0805.3806> (though they deal with a more general case than we need here). See also the original papers by [Sweedler](https://eudml.org/doc/103936 "Sweedler") and [Takeuchi](http://projecteuclid.org/euclid.jmsj/1240432948 "Takeuchi") from the `70's.


The $D$-module set-up
---------------------


Suppose $X$ is a smooth algebraic variety, and $D=D\_X$. The situation we have is the following: the category $D-mod$ and the forgetful functor to $\mathcal O-mod$, are equipped with (symmetric) monoidal structures (the duality of $D$-modules will be discussed later). 


There are many ways to understand why this should be the case, as some of the other answers indicate. For example, the category $D-mod$ can be understood as quasi-coherent sheaves on the de Rham space $X\_{dR}$ (and the ring $D$ expresses the descent data on the pullback to quasi-coherent sheaves on $X$). Alternatively, if one thinks of $D$ as a deformation quantization of $T^\ast X$, then the monoidal structure arises from the fact that the cotangent bundle is a symplectic group(oid) acting (trivially) on $X$. One can think of $T^\ast X$ as being a commutative group object in the category of symplectic varieties and lagrangian correspondences (I find this last persepective helpful in unpacking the notion of bialgebroid).


However, I think what you are after is not *why* $D$-modules have this structure, but what structure on the ring $D$ endows $D-mod$ with these structures. The answer (as has already been mentioned) is that $D$ is a bialgebroid over $\mathcal O$. Let me try my best to unpack what that means below.


The categorical structure
-------------------------


(You can ignore this bit if you don't like it).


Consider the following situation: we have monoidal categories $\mathcal C$ and $\mathcal D$ and a monoidal functor
$$F:\mathcal D \to \mathcal C$$
Suppose also that the functor $F$ is monadic, so that $\mathcal D$ can be expressed as modules for a monad $T$ acting on $\mathcal C$. The monoidal structures on $\mathcal D$, $\mathcal C$ and $F$ must then be reflected in the monad $T$. Such a structure on a monad (acting on a monoidal category $\mathcal C$) is called a bimonad. Rather than saying what this all this means in general, let's consider a special case.


Bialgebroids (over a commutative base)
--------------------------------------


Suppose $R$ is a commutative ring, and let $\mathcal C = R-mod$. Then a (colimit preserving) monad acting on $R-mod$ is nothing more than a $R$-ring, i.e. a ring $B$ with a ring homomorphism $R\to B$ (note that $R$ need not be central in $B$). In the case we are interested in $B=D$ and $R=\mathcal O$.


Before giving an algebraic definition of a bialgebroid, we note that the point of all this is that a (left) bialgebroid structure on $B$ is exactly equivalent to data of a monoidal structure on $B-mod$ and on the forgetful functor to $R-mod$. Note that if $R$ is central in $B$, this is the usual Tannakian theory, and an $R$-bialgebr*oid* is just an $R$-bialgebr*a*.


So what is an $R$-bialgebroid? Well, we already know that $B$ is an $R$-ring, so there is a product:
$$
B\_{\bullet} \otimes\_{R} {}\_\bullet B \to B
$$
where the dots indicate on which side $R$ is acting on $B$. As one might expect, there is also a coproduct, which tells you how $B$ should act on the tensor product $M \otimes\_R N$ of two left $B$-modules, but one has to be careful about which monoidal category the coalgebra structure on $B$ lives in. If you unwind the definitions, you see that the coproduct is given by a map
$$
B \to {}\_\bullet B \otimes\_R {}\_\bullet B
$$
Note that, unlike in the product map, $R$ is acting on the left on both factors. This is a little confusing at first, but perhaps not so surprising if you consider that in the category $B-mod$ we want to understand how to tensor two left $B$-modules.


Of course, there are some axioms. The one that I found hardest to digest involves something called the *Takeuchi product*. Let me try to motivate that a bit. 


Takeuchi Product
----------------


In the usual theory of bialgebras, there is an axiom which says that the coproduct is an algebra map. This doesn't make sense for bialgebroids as ${}\_\bullet B\otimes\_R {}\_\bullet B$ is not an algebra under componentwise multiplication. The Takeuchi product is a certain subspace of this object, defined by:
$$
B {}\_R \times B := \left\{ \sum b\_i \otimes b\_i' \in {}\_\bullet B\otimes\_R {}\_\bullet B \mid \sum b\_i r \otimes b\_i' = b\_i \otimes b\_i'r \right\}
$$
Note that the the $r$'s in the condition are acting on the right, whereas the relative tensor product is using multiplication on the left. Note also that if $R$ is central in $B$, then the condition is vacuous. One can check that $B {}\_R \times B$ is ring under compoentwise multiplication. One of the axioms of a bialgebroid is that the coproduct map factors through the Takeuchi product and is a ring homomorphism. (There is another interesting bialgebroid axiom, which is about the counit map, but for brevity, I won't discuss that).


The Takeuchi product (which in the $R$ commutative case appears to be due to Sweedler?) seemed somewhat mysterious to me until I saw that there is a ring isomorphism:
$$
B {}\_R \times B \simeq End\_{B^{op}\otimes B^{op}} (\_\bullet B \otimes\_R {}\_\bullet B )
$$
Thus, the comultiplication map is nothing more than the structure of a left $B$, right $B\otimes B$ bimodule on ${}\_\bullet B\otimes\_R {}\_\bullet B$. This fits well with the $D$-modules story: the coproduct on $\mathcal D$ is precisely the transfer bimpdule structure on $$ \mathcal D\_{X\to X\times X} = {}\_\bullet \mathcal D \otimes\_{\mathcal O} {}\_{\bullet} \mathcal D$$
(as it should be, as the transfer bimodule represents the tensor product functor). 


The D-module structure on Hom
-----------------------------


Let me come back to this another time...


