The reason or cause that Hamlet puts on an antic disposition in the first place is that he wants to be able to discover the truth behind his father's death, without creating too much suspicion. If he's just going around acting goofy and crazy all of the time, people won't be alarmed, if, in the midst of that goofiness, he gets near the truth of the matter. They'll just think that he is a harmless crazy-man.
However, the effects of his antics are more than he possibly could have imagined. His kooky conversation with Polonius prompts him to set up a meeting with Ophelia. This meeting really throws off Ophelia; his "get thee to a nunnery" conversation with her was really just a show for his mother and uncle, whom he suspected were watching. He wanted to express some of his pent-up anger at his mother's "o'er hasty marriage". But, his rant ends up being one of the factors that catapults Ophelia into madness. His elusive and insensitive comments regarding Polonius's body make his uncle suspicious; orders for his removal and death are dispatched. This leads to Hamlet's most overtly cruel act: the murder of his friends.
In the end, his antics end up drawing him more attention than if he had discreetly gone about making inquiries and gathering clues. It alarms his friends and family, making them keep a closer eye on him, and the cruelty associated with his antics only bring disaster on the ones he loves.