It looks like your BB cartridge is no longer pressed into the frame shell. When you removed the cranks did it just sort of fall apart? That is a signal that for whatever reason the BB is worn so that the interference fit is no longer sufficient. You should be able to remove the cranks without the BB falling out.
You generally replace the entire bottom bracket unit with a press fit and you have a reinforced composite plastic SRAM GXP bottom bracket which is definitely a single use consumable unit.
For you a GXP compatible (the crank spindle standard) bracket is required. Most cartridges will fit either 68mm or 73mm wide bottom brackets which are the two widths you’ll find in a modern bike.
You need a bearing press to install a new unit which can be as simple as a threaded rod with nuts and large washers of a bigger radius than the BB.
They are readily available online for a small price or you can construct your own if your hardware shopping options are sufficient. The pictured version came with the T shaped removal tool which is inserted inside the shell against the bearing and bonked with a hammer using a drift until the bracket half comes out.
Why the BB became worn/misshaped enough to fall out is another question. If your riding style involves a lot of out of saddle high power low rev cranking you might want to consider a less budget BB made from metal for the replacement. Or maybe the BB was just old and needs replacement.