I've been going through speed caps bypass of Indian ISP using APN hacks which involves either changing sever field or proxy field or ip-versions MNC.
I am just curious how APN works in this case. How is it used to impose speed caps?
The APN is just a field that is sent to the mobile network when your phone establishes a data connection (also called a PDP context).
Equipment down the path can decide what to do with your traffic based on the APN, like routing it to different paths of the network, routing it to a company's internal network over VPN (companies can pay to have their own APNs which connect directly to their network, bypassing the need for an on-device VPN if they trust the mobile provider - which they shouldn't do).
The behavior you're seeing is just the result of years and years of technical debt - the alternative APN you're using may not even be in use anymore by the provider, it's just still there and they've forgotten about it, so they also forgot to implement traffic shaping on it and that's why you can bypass bandwidth limits. Since we're talking about a mobile carrier, it seems that mis-selling and implementing artificial limits like data caps is more important on their roadmap than cleaning up technical debt.
On a properly designed mobile network there is no need to have more than one APN as the network can differentiate between subscribers by their SIM's ICCID (which is also sent to the network and known to the equipment managing the PDP contexts) and assign policies regardless of which APN is in use. This removes confusion and prevents customers accidentally/maliciously using a different plan which could result in an incorrect policy being applied or extra charges.
The APNs reside in the core network of your network provider and define how your device connects to certain packet switched networks like the Internet.
An ISP may provide multiple APNs. Each of this APNs may regulate the connections made via them based on different parameters (e.g. the ones you mentioned).
By changing the parameters on your device you basically take another way through the core network of your ISP into the Internet.
If the APN you choose does not regulate the traffic by imposing speed caps, you can thus circumvent them.