Highly colloquial. Two uses: (1) as a question word meaning "what are you doing" (你在干嘛), (2) as an exasperated "why on earth" (干嘛这样). Tone is casual and can sound challenging.
mistakes
干嘛 and 干什么 are near-equivalents, but 干嘛 is chattier and shows more emotion. Written 干嘛 (嘛) is standard Taiwan usage; mainland often writes 干吗.