Do you ignore the behaviour you don't want such as the whinging, hitting etc. Walk away from him when he is doing it or when he is whinging, just keep on chatting to him in a cheerful manner?
DS2 was a bit of a whinger but me and DH decided at Christmas when we literally had had enough that we would just ignore him when he came whinging (crying we would do something about obviously) but just the constant low-level whinging...it seems to have worked as he doesn't do it anywhere near as much now.
can you turn the 'telling off' bit into "I'd like you to do this please' and "it's time to...[go to bed / get dressed / whatever]" and get him to earn stars for it? If you feel that he is needing stars for absolute basic expections, then you can always up it to needing ten thousand before he gets the reward Praise every tiny glimmer of positive behaviour (exhausting in the short term, but well worth it in the longer run) and try to show him what you want by modelling it. I think we give toddlers - and even older children - credit for 'understanding' stuff that actually they just don't, like how to behave, how to sit down, all kinds of basic stuff.
PS mine loved 'races' at that age - easy easy pull-on clothing if he's not willing to accept help (my dd's one of those, "I do it mysewf" from 18mo) and he gets dressed in his corner whilst you get dressed in yours. I have absolutely no idea why it works, but it does. DS2 was a lazy more laid back type, but one trip to town in his PJ's mortified him enough to get dressed in time in future...<cruel mother emoticon>
When DD2 whines I say "Don't whine, talk properly please" and repeat. She had a BIG whiny phase and repeating this, along with making it very clear that whining NEVER got results/ignoring/turning away from whinee, managed to get things back on track. As soon as she spoke normally I would smile and respond. Good luck... We sometimes get in a negative discipline spiral with either DD1 or 2 and it's hard to step back and start again. It can be done though