Why did the shogun rule Japan?

the shogun conquered the emperor and gained rule on japan