If I were to gather up my communist comrades in my country (UK) today and lauch a coup, overthrowing our PM and Queen and putting myself in charge, the military would probably tell me to fuck off and not be loyal towards me in the case of war and not take orders, etc. Why did the military decide to support and be loyal towards Lenin after the Bolshevik coup?
Short answer: they didn't, but being promised peace from a war that's going badly was always going to down fairly well.
Longer answer: Not all the soldiers supported Lenin. And Lenin and the Bolsheviks largely regarded the army as an ancien regime force fighting an irrelevant bourgeois war among other bourgeoisie - to be used, but only as disposable pawns in the game of power.
It was more that soldiers didn't want to continue fighting a war Russia didn't have the capacity, leadership or resources to fight. When the Bolsheviks seized power in St Petersburg in 1917, they had been promised by Lenin peace, land and bread - and then deserted en masse back to their villages to chase that dream. Yet in the years of civil war to come, peace, land and bread were hard to come by.
So relatively few soldiers supported Lenin, in fact, that in the months to come, the Bolsheviks had to form a whole new army, the Red Army, with some Tsarist-era soldiers hired as military advisors - a necessary compromise to win the civil war.
Lenin and the Bolsheviks existed in extraordinary times - even a more intelligent and cunning politician or rebel in most times in history would likely get nowhere, as Trotsky (another Bolshevik and the founder of the Red Army) would later say.
Read Orlando Figes' A People's Tragedy to get a deeper understanding of how the revolution went down.