The reason it works is you are making a complete circuit. The only reason to do it the “proper” way is for safety–the negative battery terminal is grounded to the car’s chassis, and by making the last connection to the chassis, you’re avoiding a spark at the battery which can ignite flammable hydrogen gas that lead-acid car batteries produce naturally. In extreme cases, a spark can ignite the gas and cause a car battery to explode, causing injury or at least destroying the battery and showering everything nearby with acid.
The reason it didn’t work when you did it the right way is likely because you didn’t have a good connection where you attached the final cable to the car’s chassis. Where you connected the cable may have been painted, corroded, or it may have looked good but actually been isolated from the chassis. Or the car itself may have had a bad grounding strap from the engine to the frame or battery to the frame. Modern cars have so much plastic under the hood that it’s hard to find a good ground. Look for a solid piece of metal coming from the engine block, such as the bracket that holds the alternator or other accessories, or a brace that runs across the engine compartment. Wiggle the jaws of the clamp around to make sure you have a good “bite” on it and have scraped through any grease or paint on your final connection point. Also make sure that all connections are solid and will not pop loose. (don’t wiggle the connection to the battery around after everything is all hooked up, make sure that one is tight first) Also, don’t immediately try to start the disabled vehicle–give the discharged battery 5 minutes or more to build up some charge first before trying. Turn off electrical accessories on the donor car to maximize the available power. Leave the key off, door shut, etc. on the disabled vehicle until you’re ready to start so you’re not wasting the energy you’re trying to get the low battery to take. You’ll have a better chance of success and it will be less strain on the donor car’s electrical system.
I’ll admit often connecting the last connection to the battery too if I can’t find a good ground on the car’s body. I always stand far from the battery, stretch out my arm, and turn my face away when doing so. Which is generally a good idea even if you’re doing it the proper way. I also have a pair of safety glasses I wear when working on or around a car battery.
Car batteries are an old, safe technology, but mishaps do occur sometimes. Car battery acid is dilute enough on a discharged battery that it will not generally harm skin if you wash it off immediately, but eyes are a very different story.