How does the 8365 Tuneable Racer work?
I do not own this item, but observing the pictures leads to a logical inference.
The pins are in different locations.
If you look at parts, you will see that they are 5 pins wide.  One part has pins in positions 1 and 5, the other has pins in positions 2 and 3.
You then connect the parts to the motor.  With switches inside the motor, it can detect which holes have pins in.  This is similar to how the LEGO Super Mario figure knows which Power Up is attached - a simple way to test would be to attach normal pins in those locations, rather than the special parts that came with it.
This may not even be electronic, the pins may be physically changing the gear ratio inside the motor.  Which answers the last part of your question:  why do the performances appear to be reversed?
Because a high gear means lots of speed, but no torque (power), and a low gear means low speed, but lots of torque (power).  You can test this yourself on a bicycle.  On a flat path, a high gear will let you go really fast, while a low gear will mean you are slow.  But, going up a hill, a low gear will let you easily climb steeper hills, and a high gear will leave you stuck, exhausted, at the bottom!  So, the &quot;high gear&quot; item gives better performance on the &quot;speed&quot;/&quot;racing&quot; model, but the &quot;low gear&quot; item gives better performance on the &quot;power&quot;/&quot;steep ramp&quot; model