The noun is derived from mad + cap (“(informal) head”). The adjective is from an attributive use of the noun.
Practice speaking and memorizing "madcap" and many other words and sentences in English.