You cannot really infer 54 Mbps knowing only the bandwidth. It's a design tradeoff. You could theoretically build a system that would do twice this throughput in the same bandwidth under ideal conditions. The trade-off involves multiple factors, such as power requirements, implementation complexity, robustness in the face of various types of interference, and of course channel bandwidth.
So when it comes to "how the get the data rates from 802.11n and 802.11ac" the answer is, I'm afraid, "just look it up", as it comprises several well-reasoned but ultimately arbitrary decisions about all the specifics of that particular modulation scheme.
But to answer the immediate question of why 54 Mbps is the maximum for 802.11g:

802.11g uses OFDM, a pretty complex modulation scheme which employs multiple overlapping orthogonal subcarriers (meaning that at each subcarrier peak, the sidebands of all other subcarriers add up to zero). 802.11g uses 52 subcarriers, 48 of which carry data. These subcarriers are spread over 16.25 MHz (not 22!), and can be modulated using one of several constellations, of which QAM-64 is the largest. Convolution codes are used for forward error correction.
To operate at 54 Mbps, 802.11g uses the QAM-64 constellation and 3/4 convolution code rate. 48 Mbps is exactly the same but with a more redundant convolution code, 2/3. The QAM-64 constellation enables each subcarrier to carry 6 bits of information per symbol. Each symbol lasts 4µs in 802.11g.
All of the above are well reasoned but ultimately arbitrary numbers, but multiplying them together gives you: 6 bits * 48 subcarriers * 3/4 error correction coding = 216 bits per 4µs. That's 54 million bits per second.
These slides on 802.11b/g were very useful for reminding me how this worked.