How is a landscape lens different from a portrait lens optically. I believe all wide angle lenses are primarily landscape lenses and all in one is the kit lens. Is the 50mm lens primarily a portrait lens. I also understand there are different kinds of distortion in a landscape lens like pin cushion etc. Is this why they are not branded as portrait lens?
What do you mean when you say a lens is "branded" as a portrait lens or a landscape lens? I've seen lenses being listed as suitable for portrait photography or landscape photography, but that doesn't restrict their use to only that type of photography. Lens designers, as far as I'm aware, don't make design decisions in a wide-angle lens' design that preclude it from being used for portraits. There's nothing wrong with using, say, a 28mm lens for landscapes as well as for (environmental) portraits. It's mostly just about angle of view, and what angle of view is more often desirable for portraits or landscapes.
Having said that, fast short telephoto lenses have developed as good portrait lenses, and I believe there are indeed design decisions made whereby, for example, the lens can be sharper in the centre than at the edges, because it makes sense for the subject's face to be sharper than any peripheral objects. That would be different to a macro lens for example, which might be a similar focal length, but would be designed for sharper rendition across the entire frame (as well as allowing much greater magnification of macro subjects of course).
But, ultimately, it mostly comes down to angle of view. In a landscape photo, or head-and-shoulders portrait, or environmental portrait, what do you want included in the photo? You can make good photos of all these shot types with a variety of different lenses.
How is a landscape lens different from a portrait lens optically.
It isn't necessarily. It can be the same lens, in some cases. "Landscape" and "portrait" indicate usage, but not the type of lens. You can shoot landscapes with anything: ultrawide, wide, telephoto, even supertelephoto. Portraits, similarly can be done with nearly any type of lens, including fisheyes, depending on what the photographer wants to create and what type of effects they're after.
Certain types of lenses are more conventionally used by most shooters for specific tasks. But that's not the only way they can be used or necessarily the best way to define a lens.
While wide angles are often seen as better suited for landscapes, and longer fast primes are often seen as suitable for portraiture, you don't need either for either subject.
I believe all wide angle lenses are primarily landscape lenses
Not necessarily. Fisheye lenses are wide angle but are rarely used for landscape because of the distortion.
... and all in one is the kit lens.
Yes, and no. A typical kit lens can go from wide to short telephoto and so can cover both subjects if you're using conventional focal lengths, but it may also be a slower lens with a smaller max. aperture, which can't blur backgrounds the way a fast prime lens can. Some portrait shooters want to use thin DoF and prize big max. aperture lenses.
But also. A kit lens isn't necessarily a cheap 18-55 or 16-50 lens, either. My 5Dii's kit lens was a pro-grade EF 24-105 f/4L IS USM which was (at the time) around $1300. A kit lens is just a lens that comes in the box with a camera body. It can be a walkaround zoom, a telephoto zoom, a supertelephoto zoom, or a prime lens. My Olympus OM-10 (a 35mm film SLR)'s kit lens was a 50mm f/1.8 fast prime.
Is the 50mm lens primarily a portrait lens.
On crop, it's more likely. On full frame, it can also be used as a street or walkaround lens, because it's normal (not wide/not tele) as well as having magnification very close to that of the human eye.
What you want to use a 50mm lens is up to you. With pano stitching, I've used one to take very very wide scenic landscape shots; with extension tubes I've used one for macro, and I've also used it as a low light lens. AND a portrait lens.
I also understand there are different kinds of distortion in a landscape lens like pin cushion etc. Is this why they are not branded as portrait lens?
Well, nothing's actually "branded" as a portrait lens. But distortion is something you can choose to incorporate or not into a portrait. And it's also something that can be digitally corrected in post. Shorter lenses may suffer from barrel distortion, while longer ones may exhibit pincushion. And a few weird lenses have mustache/wave distortion which is a combination of both at the same time.
But shorter lenses tend to be used closer in to achieve similar framing to longer lenses, and the closer a lens is to the subject, the more perspective distortion will happen (how the lens renders subjects at different distances from the lens). The shorter the lens is, the more extreme that distortion will be. And this would be in addition to the lens distortion.
There are "portrait lenses" (in the sense that they are designed specifically for portrait photography or at least that portrait is one of their main uses) but AFAIK there are no landscape lenses.
A portrait lens is usually a short fixed telephoto (so, slightly longer that the standard lens: around 80 to 150mm for fullframe, 50 to 100mm mm for APS-C) to keep the camera far enough from the subject (putting it too close enlarges some facial features such as the nose). Canon even has a "soft-focus" lens designed for this.
You can of course use instead a decent zoom lens that covers the same focal range. If you use your kit lens,you will use the long end, which is usually not the part where they are the best, but if you have an APS-C camera there are inexpensive 50mm prime lenses that do a good job as portrait lenses.
It's worth thinking of composition sometimes as not a matter of the properties of the lens, but where you stand relative to the subject in order to compose the frame with it. From the same viewpoint you can mostly take the same picture with a wide angle as with a telephoto if you're willing to crop it to just the same angle of view in the center.
A telephoto lens is good for portraits because it's long enough to force you away from the subject to get everything in frame so there's fewer perspective effects. Meanwhile a wide angle is 'bad' for portraits because to fill the frame you would need to be in the subject's face and the perspective effects from there would turn them into a total nose monster.
It can also help that telephotos have a large absolute aperture so when you open them up they're good at cutting out the background. The math may still work out that the cropped wide-angle or normal would give the same narrow depth of field once you were enlarging it to match and increasing the rate at which things blur while leaving the plane of focus.
Portraits imaged using a wide-angle lens are seldom ever flattering. That’s because features nearer the camera like the nose, are exaggerated as to size and features like the ears are imaged too small. In other words, prospective distortion creeps in and ruins the portrait (the subject is not pleased). The remedy is to use a moderate telephoto for portraits. Such a lash-up forces the photographer to step back and this act produces an image with a pleasing perspective (little or no distortion to the physique of the subject).