Before Jefferson was inaugurated in 1801 John Adams made the Judiciary Acts which opened up more positions for judges.
John Adams tried to fill up those empty spots with judges of his choosing but before some commissions were delivered Jefferson was inaugurated and repealed the Judiciary acts so they refused to deliver the last 17 commissions.
Before the letters of commission for some appointees were delivered Jefferson told James Madison his Secretary of State not to delivered them. Then William Marbury one of the appointees sued James Madison so he would disclose why he didn't deliver the commissions.
John Marshall one of the Judges thought of this case as a lose-lose situation. If he supported the writ (Marbury's demands) then the Jefferson Administration would probably ignore it and it would weaken the power of the court even more. And If they denied it people would think the court acted out of fear. So he said Madison was in the wrong but the Court didn't have the power to issue writs.
After the court case the Judicial Branch became a even branch since they could directly review acts of Congress.
The importance of this case was made even more significant since after this case the supreme court became the arbiter of the constitution and became the final authority on how we interpret it.