For better discussion, assume a Wide Flange column section. To carry the moment more efficiently, you need to apply a moment about the Major axis. Now consider a portal frame, say all the joints are pin joint. Now use a lateral load. It will collapse. Because as all the joints are pinned, they will rotate infinitely, causing the structure to collapse.
To Resist this collapse against lateral load, you need to provide - Either fixed support instead of pinned support or make the beam-column junction by moment connection. Or you can provide both. Now, your structure is stable under lateral load.
How fixed support looks like when I section or complete flange section is used as a column section? This is a fixed column base. Here you can see that the bolts are outside of the flange, just like your moment connection. So when the moment is applied about the major axis, it's converted into push and pull, and these bolts carry this push-pull.
Now, what will happen if a moment is applied about the minor axis? When the moment is being applied about the minor axis, there is no flange about this minor axis. So, The carrying capacity is very small. So, the moment can not be converted into push and pull efficiently. And these bolts will have almost nothing to carry for this moment. So, always this moment connected base will behave as a pinned joint about the minor axis. You have already learned that if a lateral load is applied on a frame with pinned support and pinned joint, it will collapse. But In a framed structure, there always remain lateral load, which may come from wind load or friction load or any other type of load. It is also clear that even a moment connected base can not prevent that force is applied across the minor axis of the Wide Flange column. So the solution is, add any diagonal member.
Now, after applying a lateral load, will it collapse? No. Why?.. 5thstd math For given three lengths, only a single Triangle can be formed. And that's why this structure doesn't collapse under lateral load. If it collapses, this triangle has to be deformed, which is not possible. So, I think now it is clear to you why bracing is used. But how the lateral force is carried? The force travel from this point to this support through his bracing directly. Why? Because... Force is also clever like us. If I ask you to travel from this point to this point, you will not follow this path. Instead, You will take this shortcut route to reach from this point to this point. Just like that, the force also follows the shortest path. If you want more scientific reason, well, it is because of the "theory of least work." Now come to this Steel frame. Here along this Transverse direction, The Moment Connection has been used, and it is stable under the lateral load. But Along this longitudinal direction, there is no moment connection. All this joint is pinned connected. Even the support condition is also pin connected. Why this is pin connected, you have already learned that.
Let say Lateral Load is applied here at this point. And you have a point to provide bracing. So, all this lateral travel through this member up to this point. Then this goes to this point to the support through this bracing, and as this load travel through this member, each of this member are loaded axially. And it would help if you designed all this member for axial load only. So, it is clear to you why and when bracing needs to be used. What is the reason? i. When all the joints are pinned joint and ii. The lateral load needs to be carried. In those cases, we need to use bracing.