Jesus did not enter the actual temple. He entered the courtyard around the temple.
Merchants were selling animals and other items that travelers bought to offer the proper sacrifices at the temple.