Partial derivative of image using mask
Partial derivatives in discrete domains are computed using differences (finite difference in more proper terms). There are many methods to do that such as central finite difference or forward, backward and so on. 

The convolution operation you mentioned computes forward distances in horizontal direction and results in x-derivatives (namely the $x$ component of the gradient). 

To also compute in $y$ direction you might do:

fx = conv2(im1,0.25* [-1 -1; 1 1]) 


0.25 is there just to scale the values to appropriate range (weights each pixel the same).

For more information on finite differencing you might check:
http://en.wikipedia.org/wiki/Finite_difference#Forward.2C_backward.2C_and_central_differences

Convolution is a local-masking operation where at each pixel you compute the dot product of the kernel and matrix part that corresponds to the kernel. Then, kernel is shifted. I won't go to the details of convolution as it is already explaind in http://en.wikipedia.org/wiki/Convolution. However, let's say we have a matrix 

$
   I=
  \left[ {\begin{array}{cc}
   1 &amp; 2 &amp; 4 \\
   6 &amp; 14 &amp; 17\\
   16 &amp; 41 &amp; 18\\
  \end{array} } \right]
$

If we convolve this with the kernel mentioned and discard for now the boundary conditions, we end up with

$
   G=
  \left[ {\begin{array}{cc}
   -2.25 &amp;  -1.25 \\
   -8.25 &amp;  5.0 \\
  \end{array} } \right]
$

(this is part in the middle of the result). 

So, you should notice that basically, per each element, we compute a sum of 2 neighbors vertically on the left, sum of 2 neighbors vertically on the right and subtract these intermediate results. As subtraction is done horizontally, it computes the horizontal derivatives. This is what convolution intrinsically does.