How to implement a convolution function in VHDL?
It is hard to say for certain why f is getting set to 0, but I do see problems with your code.

For starters, sum is never initialized to 0.0 near the beginning of the process.  You set it at the end, after f is assigned, but it makes no difference there.  With some synthesizers/simulators your code might work, but it is still bad practice and won't always work.  It is better to initialize sum.

Next, look at this code segment.  I have substituted 'range with the actual values for clarity:

for n in 0 to 4 loop
     for k in 0 to 1 loop
        sum := sum + x(k) * y(n-k);


What happens if n=0 and k=1?  Then you are indexing y(-1), which is an invalid index.  I am surprised that your simulator is not complaining about this.

So I don't know why f is zero; but with sum not being initialized and using invalid indexes for y, you certainly won't get the results you expect.