In almost all microphone designs, it's quite simply because that's the way the diaphragm faces.
A hand-held mic has the diaphragm set at 90° to the body, so you point it at the sound.
The standard large diaphragm condenser as in your photos has it in line with the body, so the pickup pattern is seemingly from 'the side'. Cosmetically, this is why they have really obvious seams & faces, so you don't have to guess which way it's pointing.
A microphone's pickup pattern is determined as much by the electronic configuration as the diaphragm orientation. A single diaphragm, as in the SM58 is only capable of cardioid pickup - ie, mainly in front. If it could be termed as such, a mic's 'natural state of being' is cardioid.
This type of configuration is built with the diaphragm connected to a wire coil inside a magnet - the same as a loudspeaker - which also dictates its orientation in the mic body. See https://www.shure.com/en-EU/performance-production/louder/how-they-did-it-inside-the-sm58
To get omni or figure 8 pickup you need two diaphragms, set back to back. This already dictates [in the main, there are exceptions] that the diaphragms themselves must be clear of the body & potential interference; hence they 'sit up' from it, in line with the body, rather than being buried into it like a hand-held.
Switchable patterns are enabled by changing the phase characteristics or reducing the gain of one diaphragm in relation to the other, causing areas of sound rejection.
There's a good explanation at https://www.tvtechnology.com/opinions/microphones-with-switchable-polar-patterns though sadly lacking the diagrams it refers to.
I mentioned exceptions - of which the B&K (now DPA) 4006 is one remarkable exception. It is an omni in a 90° configuration. I have no clue how they actually achieve this, but the results are stunning. Polar pattern changes are achieved not electronically, but by changing the diffuser grid which covers the diaphragm, or with the addition of acoustic 'shapers'.