Sometimes an idea that seems reasonable just isn't legal, and that's the case with wiring a ceiling fan to a cord so you can plug the fan into an outlet. The procedure would be simple enough, but there are several problems with this approach that will get you into trouble with the electrical inspector. If you really want a fan that plugs into an outlet, buy one that's designed for it and doesn't have to be installed in an electrical box. You can buy a fan that's a sealed unit designed to hang from a hook attached to one of the ceiling joists or screw into a light socket. If it has a cord, the cord is either already attached or it plugs into a built-in terminal on the fan housing.
Problems With Cording an Existing Fan
A conventional ceiling fan mounts to a electrical box which is braced to the ceiling joists to make it capable of supporting the weight. The live circuit wire and the switch wire typically run behind the wall and ceiling, and are connected to the fan wires inside the box. If you eliminate the switch and substitute an extension cord for the circuit wire, you'll have to wire the cord to the fan wires inside the box, but it's illegal to do that. The code does not permit wiring external cords inside electrical boxes. That's problem number one.
Video of the Day
If you were to wire the cord to the fan anyway, you'd probably have to run the cord behind the ceiling for a short distance until you can feed it through an opening. That's problem number two. It's illegal to run an extension cord behind a wall or ceiling and to run it through a hole.
Problem number three is a general prohibition in the electrical code against using extension cords to substitute for permanent wiring. You may be able to convince some inspectors that, because you plug the fan in only when using it, the wiring isn't permanent, but not all inspectors will agree.
One more thing. Electrical inspectors tend to prefer a ceiling fan be connected to a working switch. It's doubtful that many would consider a plug-in cord a suitable substitute.
Forget About Using a Swag Kit
You can buy swag kits at most hardware stores intended to convert hardwired light fixtures into plug-in units. The cords that come with these kits are 16 or 18-gauge, which is too light for a fan and draws considerably more power than a light. If you want a cord with 14 or 12-gauge wire, which won't overheat under the load a fan generates, you might be forced to make your own out of Romex, and guess what? It's illegal to connect a plug to Romex. You could make a cord out of a heavy-duty exterior extension cord, but it won't come with the chain and attachments of a swag kit.
Buy a Plug-In Fan
Given all the problems, it's best not to try to convert your existing ceiling fan to a plug-in fan. If you want to keep the fan you have, get an electrician to wire it properly to a switch, or do it yourself. If you really have to have a plug-in fan, choose one from the many models available at building supply stores and online. One of the big advantages of this type of fan is that it's moveable. That means you can use the same fan in different parts of the house, or even outdoors.