Discover the possibilities
With the new ArcGIS Online release (9.1), grouping layers in ArcGIS Online is available and supported. The new Map Viewer (previously Map Viewer beta) allows you to do so. This is a useful functionality that ArcGIS users had asked for a while. This option is not available in Map Viewer classic.
The ability to group layers is something you can do both on ArcGIS Pro and ArcGIS Desktop. Group layers help organize related kinds of layers in a map [source].
How to group layers in ArcGIS Online?
To group layers in ArcGIS Online, you should go to the Map tab and access the Map Viewer.
In the animated example below we use a Rivers and a Lakes layer and then we group them together into one group layer we have called Surface waters.
ArcGIS Instant Apps will also show your layers grouped. But not your Web AppBuilder apps.
Layers grouped in ArcGIS Pro published to ArcGIS Online will also appear grouped using the new Map Viewer. This is only one of the new functionalities that are available within the new Map Viewer.
How about grouping layers in ArcGIS Enterprise Portal?
Up until now (April 2021), ArcGIS Enterprise Portal does not support grouping layers interactively within the Map Viewer. You can only have grouped layers if you group them in ArcGIS Pro before publishing, then share them as a web layer and include it in your web map . However, this functionality will be available in future releases of ArcGIS Enterprise.