The reason for using a hood is to block light rays from elements outside of the actual frame (stray light) to enter into the lens and degrade the image quality (lowering contrast). Effectively, it "shades" the lens from these rays. Since a sensor is rectangular, valid light rays that fall on the corners arrive from angles larger than light rays that fall on the middle of the sensor's edge. This is why many hoods have the "petal" form. Otherwise you will suffer from either vignetting at the frame corners, or lower effectiveness in blocking invalid rays.
With increasing focal length, the petal shape becomes less required and there is a transition to circular shape. Another reason for circular hoods is rotating front elements of the lens, where the hood is mounted. When focusing, the element (and hood) rotates so if you use petal hood it will lose its alignment with the sensor.