The second call to legend() is replacing the first legend (you can only have 1 legend).
I reworked your code to use yyaxis instead of plotyy.
Solution 1: use 1 legend
This solution puts all handles into the same legend. See inline comments for details.
n=-180:180;
x=(pi/180).*n;
y=sin(x);
y2=sin(x).*cos(x);
y3=cos(x);
yyaxis left
h1 = plot(n,y, '-k', 'LineWidth', 1, 'DisplayName', 'h1');
set(gca, 'YColor', 'k')
hold on
h3=line(n,y3,'Color','r','LineWidth',2, 'DisplayName', 'h3');
yyaxis right
h2 = plot(n,y2, '-b', 'LineWidth', 1.5, 'DisplayName', 'h2');
set(gca, 'YColor', 'b')
Solution 2: kludge in a 2nd legend
Since you can only have 1 legend per axis, this solution produces a second invisible axis and copies the h2 object to the invisible axis so that it can have its own legend. See inline comments for details.
n=-180:180;
x=(pi/180).*n;
y=sin(x);
y2=sin(x).*cos(x);
y3=cos(x);
yyaxis left
h1 = plot(n,y, '-k', 'LineWidth', 1, 'DisplayName', 'h1');
set(gca, 'YColor', 'k')
hold on
h3=line(n,y3,'Color','r','LineWidth',2, 'DisplayName', 'h3');
yyaxis right
h2 = plot(n,y2, '-b', 'LineWidth', 1.5, 'DisplayName', 'h2');
set(gca, 'YColor', 'b')
legend([h1,h3], 'Location', 'NorthWest')
ax = gca();
axisCopy = axes('Position', ax.Position, 'Visible', 'off');
hCopy = copyobj(h2, axisCopy);
hCopy.XData = nan(size(hCopy.XData));
legend(hCopy, 'Location', 'NorthEast')