I read that he was a peasant that ended up ruling Japan. How did he become noticed by Oda Nobunaga if he was just a peasant ?
He wasn't really a "peasant" per se.
The story typically goes that he was born the son of an ashigaru, or "light foot soldier," which was inferior to the bushi, or "warrior" class. After working for the Imagawa clan for a few years, he stole some money and eventually found himself in the employ of the Oda clan, serving as one of Nobunaga's sandal-bearers. The story here is that apparently he was first noticed by Nobunaga as he kept Nobunaga's slippers warm by keeping them in his robes. This seemingly minor act made Nobunaga realize that despite looking like a monkey, Hideyoshi was smarter than he looked.
When the Imagawa clan attacked Oda's territories, Nobunaga launched a surprise attack on the Imagawa army at Okehazama, killing Imagawa's leader and decisively breaking the Imagawa clan's power. It was supposedly during this battle that Nobunaga noticed the military talents of Hideyoshi, and started employing him in greater roles, including managing the kitchens, conducting repairs on Kiyosu castle, and eventually being a diplomat and tactician.